/* YS Certificate Plugin - Front-end Styling */

/* Messages */
.ys-cert-message {
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
}

.ys-cert-message.ys-cert-error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.ys-cert-message.ys-cert-info {
    background-color: #f0f8ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.ys-cert-message.ys-cert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Mark Sheet Container */
.ys-marksheet-container {
    margin: 20px 0;
}

.ys-marksheet-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.ys-marksheet-header {
    text-align: center;
    border-bottom: 2px solid #ddd;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.ys-marksheet-header h2 {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.ys-marksheet-subtitle {
    margin: 5px 0;
    font-size: 12px;
    color: #666;
}

.ys-marksheet-body {
    margin: 20px 0;
}

.ys-marksheet-table {
    width: 100%;
    margin-bottom: 20px;
    border-collapse: collapse;
}

.ys-marksheet-table tr {
    border-bottom: 1px solid #eee;
}

.ys-marksheet-table td {
    padding: 12px;
}

.ys-marksheet-table td.label {
    font-weight: bold;
    width: 40%;
    background-color: #f9f9f9;
}

.ys-marksheet-table td.value {
    text-align: left;
}

.ys-wrap-long {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ys-marksheet-marks-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    border: 1px solid #999;
}

.ys-marksheet-marks-table thead {
    background-color: #e8e8e8;
    font-weight: bold;
}

.ys-marksheet-marks-table th,
.ys-marksheet-marks-table td {
    padding: 10px;
    border: 1px solid #999;
    text-align: left;
}

.ys-marksheet-marks-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.ys-marksheet-marks-table th:last-child,
.ys-marksheet-marks-table td:last-child {
    text-align: center;
}

.ys-total-row {
    background-color: #fffacd !important;
    font-weight: bold;
}

.ys-marksheet-assessment {
    margin: 20px 0;
    padding: 15px;
    background-color: #f0f0f0;
    border-radius: 4px;
}

.ys-marksheet-assessment h4 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: bold;
}

.ys-assessment-table {
    width: 100%;
    border-collapse: collapse;
}

.ys-assessment-table td {
    padding: 8px;
}

.ys-assessment-table td:first-child {
    font-weight: bold;
    width: 40%;
}

.ys-result-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.ys-percentage,
.ys-class {
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

.ys-percentage {
    background-color: #e3f2fd;
    border-left: 4px solid #2196F3;
}

.ys-percentage p {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.ys-percentage strong {
    font-size: 24px;
    color: #2196F3;
    display: block;
    margin-top: 5px;
}

.ys-class {
    border-left: 4px solid #9C27B0;
}

.ys-class p {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.ys-class-value {
    margin-top: 8px;
}

.ys-class-value strong {
    font-size: 20px;
    color: #9C27B0;
}

.ys-class.distinction {
    border-left-color: #FFD700;
    background-color: #fffacd;
}

.ys-class.distinction strong {
    color: #FFD700;
}

.ys-class.first-class {
    border-left-color: #8BC34A;
    background-color: #f1f8e9;
}

.ys-class.first-class strong {
    color: #8BC34A;
}

.ys-class.second-class {
    border-left-color: #FF9800;
    background-color: #fff3e0;
}

.ys-class.second-class strong {
    color: #FF9800;
}

.ys-exam-date {
    text-align: center;
    padding: 15px;
    background-color: #f0f0f0;
    border-radius: 4px;
}

.ys-exam-date p {
    margin: 0;
    font-size: 12px;
}

.ys-marksheet-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

/* Certificate Container */
.ys-certificate-container {
    margin: 20px 0;
}

.ys-certificate-card {
    background: white;
    border: 3px solid #b8830b;
    border-radius: 4px;
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.ys-certificate-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #b8830b;
}

.ys-certificate-header h2 {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.ys-cert-logo-text {
    margin: 5px 0;
    font-size: 12px;
    color: #666;
}

.ys-cert-cin {
    margin: 5px 0;
    font-size: 11px;
    color: #999;
    font-weight: bold;
}

.ys-certificate-body h1 {
    font-size: 28px;
    margin: 20px 0;
    color: #333;
}

.ys-cert-text {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    margin: 15px 0;
}

.ys-cert-name {
    margin: 30px 0;
}

.ys-cert-name h3 {
    font-size: 24px;
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #333;
    color: #333;
}

.ys-cert-details {
    margin: 30px 0;
    font-size: 13px;
    color: #666;
}

.ys-cert-footer-text {
    margin: 30px 0;
    font-size: 11px;
    color: #666;
    text-align: justify;
}

.ys-cert-footer-text p {
    margin: 10px 0;
}

.ys-certificate-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

/* Download Button */
.ys-download-btn {
    padding: 12px 30px;
    background-color: #b8830b;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.ys-download-btn:hover {
    background-color: #8a6208;
}

.ys-download-btn:active {
    transform: scale(0.98);
}

/* Preview Button */
.ys-preview-btn {
    padding: 12px 30px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 10px;
}

.ys-preview-btn:hover {
    background-color: #5a6268;
}

.ys-preview-btn:active {
    transform: scale(0.98);
}

/* Button Group */
.ys-certificate-actions,
.ys-marksheet-footer,
.ys-card-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Dashboard Tabs */
.ys-dashboard-container {
    max-width: 900px;
    margin: 20px auto;
}

.ys-dashboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.ys-tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #666;
    transition: all 0.3s ease;
}

.ys-tab-btn:hover {
    color: #333;
}

.ys-tab-btn.active {
    color: #b8830b;
    border-bottom-color: #b8830b;
}

.ys-tab-content {
    display: none;
}

.ys-tab-content.active {
    display: block;
}

/* Verification Container */
.ys-verification-container {
    margin: 40px 0;
}

.ys-verification-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 40px;
    max-width: 600px;
    margin: 0 auto;
}

.ys-verification-header {
    text-align: center;
    margin-bottom: 30px;
}

.ys-verification-header h1 {
    margin: 0 0 10px;
    font-size: 24px;
    color: #333;
}

.ys-verification-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.ys-cert-form-group {
    margin-bottom: 20px;
}

.ys-cert-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.ys-cert-form-group input,
.ys-cert-form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.ys-cert-form-group input:focus {
    outline: none;
    border-color: #b8830b;
    box-shadow: 0 0 5px rgba(184, 131, 11, 0.2);
}

.ys-verify-btn {
    width: 100%;
    padding: 12px;
    background-color: #b8830b;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.ys-verify-btn:hover {
    background-color: #8a6208;
}

.ys-verification-divider {
    text-align: center;
    margin: 30px 0;
    position: relative;
}

.ys-verification-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    right: 0;
    height: 1px;
    background: #ddd;
}

.ys-verification-divider span {
    background: white;
    padding: 0 10px;
    position: relative;
    z-index: 1;
    color: #999;
}

.ys-verification-qr {
    text-align: center;
}

.ys-verification-qr label {
    display: block;
    margin-bottom: 15px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

#ys-qr-scanner {
    background-color: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: 4px;
    padding: 40px 20px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.ys-cert-result {
    margin-top: 30px;
    width: 100%;
    padding: 0;
    border-radius: 4px;
    box-sizing: border-box;
    animation: slideIn 0.3s ease;
}

.ys-cert-result.hidden {
    display: none;
}

.ys-result-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    border-radius: 4px;
    width: 100%;
    padding: 24px;
    box-sizing: border-box;
}

.ys-result-success h3 {
    margin: 0 0 15px;
    color: #155724;
    font-size: 18px;
}

.ys-result-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    border-radius: 4px;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.ys-result-error h3 {
    margin: 0 0 10px;
    color: #721c24;
    font-size: 18px;
}

.ys-result-error p {
    margin: 0;
}

.ys-result-table {
    width: 100%;
    border-collapse: collapse;
}

.ys-result-table tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.ys-result-table th,
.ys-result-table td {
    padding: 10px;
    text-align: left;
}

.ys-result-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ys-result-table th {
    font-weight: bold;
    width: 40%;
}

.ys-result-preview {
    width: 100%;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
}

.ys-result-preview h4 {
    margin: 0 0 14px;
    color: #155724;
    font-size: 16px;
}

.ys-result-preview-frame {
    position: relative;
    width: 100%;
    background: #fff;
    border: 1px solid #b7d8bf;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(21, 87, 36, 0.08);
    aspect-ratio: 756 / 522;
    min-height: 360px;
}

.ys-result-preview-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.ys-preview-iframe.is-loading {
    opacity: 0;
}

.ys-preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f5fbf6 100%);
    color: #155724;
    z-index: 1;
}

.ys-preview-loading.is-hidden {
    display: none;
}

.ys-preview-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(21, 87, 36, 0.18);
    border-top-color: #155724;
    border-radius: 50%;
    animation: ys-preview-spin 0.8s linear infinite;
}

.ys-preview-loading-text {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    padding: 0 18px;
}

@keyframes ys-preview-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard Rows Layout */
.ys-dashboard-container {
    max-width: 900px;
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.ys-dashboard-row {
    width: 100%;
}

.ys-dashboard-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.ys-dashboard-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ys-card-header {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    padding: 20px;
    border-bottom: 2px solid #b8830b;
}

.ys-card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.ys-card-body {
    padding: 25px;
}

.ys-card-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.ys-detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ys-detail-item .ys-label {
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ys-detail-item .ys-value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.ys-class-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
}

.ys-class-badge.distinction {
    background-color: #fffacd;
    color: #FFD700;
    border: 1px solid #FFD700;
}

.ys-class-badge.first-class {
    background-color: #f1f8e9;
    color: #8BC34A;
    border: 1px solid #8BC34A;
}

.ys-class-badge.second-class {
    background-color: #fff3e0;
    color: #FF9800;
    border: 1px solid #FF9800;
}

.ys-class-badge.fail {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.ys-status-passed {
    display: inline-block;
    padding: 6px 12px;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
}

.ys-card-footer {
    padding: 20px 25px;
    background-color: #fafafa;
    border-top: 1px solid #eee;
    text-align: center;
}

.ys-dashboard-card .ys-download-btn {
    padding: 12px 40px;
    font-size: 14px;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ys-marksheet-card,
    .ys-certificate-card,
    .ys-verification-card {
        padding: 20px;
    }

    .ys-result-box {
        grid-template-columns: 1fr;
    }

    .ys-certificate-body h1 {
        font-size: 20px;
    }

    .ys-cert-name h3 {
        font-size: 18px;
    }

    .ys-marksheet-marks-table {
        font-size: 12px;
    }

    .ys-marksheet-marks-table th,
    .ys-marksheet-marks-table td {
        padding: 6px 3px;
    }

    .ys-dashboard-tabs {
        flex-direction: column;
    }

    .ys-tab-btn {
        text-align: left;
    }

    .ys-card-details {
        grid-template-columns: 1fr;
    }

    .ys-dashboard-container {
        gap: 20px;
    }

    .ys-card-header {
        padding: 15px;
    }

    .ys-card-body {
        padding: 15px;
    }

    .ys-card-footer {
        padding: 15px;
    }

    .ys-result-preview-frame {
        min-height: 240px;
    }

    .ys-result-table th,
    .ys-result-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .ys-result-table th {
        padding-bottom: 4px;
    }

    .ys-result-table td {
        padding-top: 0;
    }
}
