/**
 * Frontend styles for Tuba Certificate Verification.
 * Uses CSS variables injected from settings.
 *
 * @package Tuba_Certificate_Verification
 */

.tcb-verification-wrap {
    --tcb-primary: #2c1810;      /* Dark Coffee Brown */
    --tcb-secondary: #b68d40;    /* Premium Gold Coffee */
    --tcb-text: #3e2c23;         /* Deep Espresso Text */
    --tcb-bg: #f8f4ee;           /* Creamy Coffee Background */
    --tcb-success: #6f4e37;      /* Coffee Brown Success */
    --tcb-error: #8b2e1f;        /* Dark Mocha Red */
    --tcb-radius: 14px;
    --tcb-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --tcb-shadow-hover: 0 18px 50px rgba(0, 0, 0, 0.12);
    --tcb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Bengali", sans-serif;

    max-width: 720px;
    margin: 40px auto;
    padding: 0 16px;
    font-family: var(--tcb-font);
    color: var(--tcb-text);
    box-sizing: border-box;
}

.tcb-verification-wrap *,
.tcb-verification-wrap *::before,
.tcb-verification-wrap *::after {
    box-sizing: border-box;
}

/* Logo */
.tcb-logo-wrap {
    text-align: center;
    margin-bottom: 20px;
}

.tcb-logo {
    max-height: 90px;
    max-width: 100%;
    width: auto;
    display: inline-block;
}

/* Card */
.tcb-verification-card {
    background: var(--tcb-bg);
    border-radius: var(--tcb-radius);
    box-shadow: var(--tcb-shadow);
    padding: 40px 32px;
    border-top: 5px solid var(--tcb-primary);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.tcb-verification-card:hover {
    box-shadow: var(--tcb-shadow-hover);
}

.tcb-card-header {
    text-align: center;
    margin-bottom: 28px;
}

.tcb-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tcb-primary), var(--tcb-secondary));
    color: #fff;
    margin-bottom: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.tcb-card-title {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 700;
    color: var(--tcb-primary);
    letter-spacing: -0.3px;
}

.tcb-card-subtitle {
    margin: 0;
    font-size: 15px;
    color: var(--tcb-text);
    opacity: 0.75;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Form */
.tcb-form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.tcb-input-group {
    flex: 1;
    min-width: 220px;
}

.tcb-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--tcb-text);
}

.tcb-input-group input {
    width: 100%;
    padding: 13px 16px !important;
    border: 2px solid #e3e3e3;
    border-radius: 10px;
    font-size: 15px;
    font-family: var(--tcb-font);
    color: var(--tcb-text);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tcb-input-group input:focus {
    outline: none;
    border-color: var(--tcb-primary);
    box-shadow: 0 0 0 4px rgba(30, 115, 190, 0.12);
}

/* Verify Button */
.tcb-form-row p {
    margin: 0;
}

.tcb-verify-btn {
    background: linear-gradient(135deg, var(--tcb-primary), var(--tcb-secondary));
    color: #fff;
    border: none !important;
    padding: 13px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--tcb-font);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    white-space: nowrap;
}

.tcb-verify-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.tcb-verify-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.tcb-btn-loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tcb-spin 0.7s linear infinite;
    display: none;
}

.tcb-verify-btn.is-loading .tcb-btn-text {
    opacity: 0.5;
}

.tcb-verify-btn.is-loading .tcb-btn-loader {
    display: inline-block;
}

@keyframes tcb-spin {
    to { transform: rotate(360deg); }
}

/* Result Area */
.tcb-result-area {
    margin-top: 24px;
}

.tcb-result-empty {
    display: none;
}

/* Alert Boxes */
.tcb-alert {
    padding: 16px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    animation: tcb-fade-in 0.4s ease;
}

.tcb-alert-success {
    background: rgba(46, 125, 50, 0.1);
    color: var(--tcb-success);
    border-left: 4px solid var(--tcb-success);
}

.tcb-alert-error {
    background: rgba(198, 40, 40, 0.08);
    color: var(--tcb-error);
    border-left: 4px solid var(--tcb-error);
}

.tcb-alert-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@keyframes tcb-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Certificate Card */
.tcb-cert-result {
    animation: tcb-fade-in 0.5s ease;
}

.tcb-cert-card {
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.tcb-cert-card-header {
    background: linear-gradient(135deg, var(--tcb-primary), var(--tcb-secondary));
    color: #fff;
    padding: 20px 24px;
    text-align: center;
}

.tcb-cert-card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.tcb-cert-card-header p {
    margin: 4px 0 0;
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.tcb-cert-card-body {
    padding: 24px;
}

.tcb-cert-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 24px;
}

.tcb-cert-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tcb-cert-field.full {
    grid-column: 1 / -1;
}

.tcb-cert-field-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #888;
}

.tcb-cert-field-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--tcb-text);
    word-break: break-word;
}

.tcb-cert-field-value.tcb-grade {
    display: inline-block;
    padding: 4px 12px;
    background: var(--tcb-secondary);
    color: #fff;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    align-self: flex-start;
}

.tcb-cert-field-value.tcb-cert-id {
    font-family: 'Courier New', monospace;
    color: var(--tcb-primary);
    background: rgba(30, 115, 190, 0.08);
    padding: 4px 10px;
    border-radius: 6px;
    align-self: flex-start;
    font-size: 14px;
}

.tcb-cert-card-footer {
    padding: 18px 24px;
    border-top: 1px dashed #e0e0e0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    background: #fafafa;
}

.tcb-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    font-family: var(--tcb-font);
}

.tcb-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.tcb-btn-preview {
    background: #fff;
    color: var(--tcb-primary);
    border: 2px solid var(--tcb-primary);
}

.tcb-btn-download {
    background: var(--tcb-primary);
    color: #fff;
}

.tcb-btn-search-again {
    background: #fff;
    color: var(--tcb-text);
    border: 2px solid #ddd;
}

/* Preview Modal */
.tcb-preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: tcb-fade-in 0.3s ease;
}

.tcb-preview-modal.is-open {
    display: flex;
}

.tcb-preview-modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    padding: 20px;
}

.tcb-preview-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.tcb-preview-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.tcb-preview-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

.tcb-preview-fallback {
    text-align: center;
    padding: 60px 20px;
}

.tcb-preview-fallback svg {
    width: 64px;
    height: 64px;
    color: var(--tcb-primary);
    margin-bottom: 12px;
}

.tcb-preview-fallback p {
    color: var(--tcb-text);
    margin-bottom: 18px;
}

/* Footer Credit */
.tcb-footer-credit {
    text-align: center;
    margin-top: 18px;
    font-size: 12px;
    color: #888;
    opacity: 0.85;
}

.tcb-footer-credit a {
    color: var(--tcb-primary);
    text-decoration: none;
    font-weight: 600;
}

.tcb-footer-credit a:hover {
    text-decoration: underline;
}

/* ============== Responsive ============== */
@media (max-width: 600px) {
    .tcb-verification-wrap {
        margin: 20px auto;
    }

    .tcb-verification-card {
        padding: 28px 18px;
    }

    .tcb-card-title {
        font-size: 22px;
    }

    .tcb-form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .tcb-verify-btn {
        width: 100%;
        justify-content: center;
    }

    .tcb-cert-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .tcb-cert-card-footer {
        flex-direction: column;
    }

    .tcb-action-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 400px) {
    .tcb-card-title {
        font-size: 20px;
    }

    .tcb-card-subtitle {
        font-size: 13px;
    }

    .tcb-badge-icon {
        width: 54px;
        height: 54px;
    }

    .tcb-badge-icon svg {
        width: 26px;
        height: 26px;
    }
}
