/* ===========================
   Variables & Reset
   =========================== */
:root {
    /* Corporate Colors - Sinergy Professional */
    --corporate-dark: #32373c;
    --corporate-black: #1a1a1a;
    --accent-blue: #0693e3;
    --success: #00d084;
    --success-dark: #00b872;
    --error: #cf2e2e;
    --error-dark: #b52828;
    --warning: #ff9500;

    /* Neutrals */
    --gray-50: #f8f9fa;
    --gray-100: #e9ecef;
    --gray-200: #dee2e6;
    --gray-300: #ced4da;
    --gray-500: #6c757d;
    --gray-600: #495057;
    --gray-700: #343a40;
    --gray-900: #212529;

    /* Effects */
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 2px 6px 0 rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: var(--corporate-black);
    min-height: 100vh;
    line-height: 1.5;
    font-size: 0.875rem;
}

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0.625rem;
}

/* ===========================
   Header
   =========================== */
.header {
    padding: 0.875rem 1rem;
    background: white;
    border-radius: 0.375rem;
    box-shadow: var(--shadow);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.header .logo {
    height: 2.5rem;
    width: auto;
    flex-shrink: 0;
}

.header-text h1 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--corporate-black);
    letter-spacing: 0;
    margin: 0;
}

.subtitle {
    color: var(--gray-600);
    font-size: 0.75rem;
    margin-top: 0.125rem;
}

/* ===========================
   Scanner Container
   =========================== */
.scanner-container {
    background: white;
    border-radius: 0.375rem;
    padding: 0.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 0.75rem;
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.scanner-header h2 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-900);
}

.btn-switch {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--gray-100);
    border: none;
    border-radius: 0.375rem;
    color: var(--gray-700);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-switch:hover {
    background: var(--gray-200);
}

.btn-switch svg {
    width: 1rem;
    height: 1rem;
    stroke-width: 2;
}

.qr-reader {
    border-radius: 0.375rem;
    overflow: hidden;
    border: 2px dashed var(--gray-300);
    margin-bottom: 0.5rem;
    min-height: 180px;
    background: var(--gray-50);
}

.scanner-status {
    text-align: center;
    padding: 0.375rem 0.5rem;
    background: var(--gray-50);
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.scanner-status p {
    color: var(--gray-600);
    font-size: 0.75rem;
    margin: 0;
}

.scanner-status.scanning {
    background: #e3f2fd;
    color: #0574b8;
    border-left: 3px solid var(--accent-blue);
}

.scanner-status.success {
    background: #d1fae5;
    color: var(--success-dark);
    border-left: 3px solid var(--success);
}

.scanner-status.error {
    background: #fee2e2;
    color: var(--error-dark);
    border-left: 3px solid var(--error);
}

/* ===========================
   Buttons - Corporate Dark Style
   =========================== */
.btn-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3125rem;
    padding: 0.5625rem 0.875rem;
    background: var(--corporate-dark);
    color: white;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--corporate-black);
}

.btn-primary svg {
    width: 1rem;
    height: 1rem;
    stroke-width: 2;
}

.btn-secondary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3125rem;
    padding: 0.5rem 0.875rem;
    background: white;
    color: var(--gray-700);
    border: 1.5px solid var(--gray-300);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.btn-secondary:hover {
    border-color: var(--gray-400);
    background: var(--gray-50);
}

.btn-secondary svg {
    width: 0.9375rem;
    height: 0.9375rem;
    stroke-width: 2;
}

/* ===========================
   Divider
   =========================== */
.divider {
    display: flex;
    align-items: center;
    margin: 0.625rem 0;
    color: var(--gray-500);
    font-size: 0.6875rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-300);
}

.divider span {
    padding: 0 0.5rem;
}

/* ===========================
   Manual Input
   =========================== */
.manual-input-container {
    background: white;
    border-radius: 0.375rem;
    padding: 0.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 0.75rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.section-header h2 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-900);
}

.btn-close {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: none;
    border-radius: 0.375rem;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-close:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.btn-close svg {
    width: 1rem;
    height: 1rem;
    stroke-width: 2;
}

.form-group {
    margin-bottom: 0.625rem;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.form-group input {
    width: 100%;
    padding: 0.4375rem 0.625rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(6, 147, 227, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.1875rem;
    font-size: 0.6875rem;
    color: var(--gray-500);
    line-height: 1.3;
}

/* ===========================
   Result Container
   =========================== */
.result-container {
    margin-bottom: 0.75rem;
}

.result-card {
    background: white;
    border-radius: 0.375rem;
    padding: 0.75rem;
    box-shadow: var(--shadow-lg);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.625rem;
    padding-bottom: 0.625rem;
    border-bottom: 1.5px solid var(--gray-200);
}

.result-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.result-icon.success {
    background: var(--success);
}

.result-icon.error {
    background: var(--error);
}

.result-icon::after {
    content: '';
    width: 1rem;
    height: 1rem;
    background-size: contain;
}

.result-icon.success::after {
    content: '✓';
    font-size: 1rem;
    color: white;
    font-weight: bold;
}

.result-icon.error::after {
    content: '✕';
    font-size: 1rem;
    color: white;
    font-weight: bold;
}

.result-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.result-header h2.success {
    color: var(--success-dark);
}

.result-header h2.error {
    color: var(--error-dark);
}

.result-body {
    margin-bottom: 0.75rem;
}

.info-grid {
    display: grid;
    gap: 0.375rem;
}

.info-item {
    padding: 0.5rem 0.625rem;
    background: var(--gray-50);
    border-radius: 0.25rem;
    border-left: 3px solid var(--accent-blue);
}

.info-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-500);
    letter-spacing: 0.02em;
    margin-bottom: 0.125rem;
}

.info-value {
    font-size: 0.75rem;
    color: var(--gray-900);
    word-break: break-all;
    line-height: 1.3;
}

.error-list {
    list-style: none;
    padding: 0;
}

.error-list li {
    padding: 0.5rem 0.75rem;
    background: #fee2e2;
    color: var(--error-dark);
    border-radius: 0.375rem;
    margin-bottom: 0.375rem;
    border-left: 3px solid var(--error);
    font-size: 0.75rem;
}

/* ===========================
   Loading Overlay
   =========================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay p {
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.75rem;
}

/* ===========================
   Footer - Corporate Minimal
   =========================== */
.footer {
    padding: 0.875rem 1rem;
    background: white;
    border-radius: 0.375rem;
    box-shadow: var(--shadow);
    margin-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.footer-logo {
    height: 2rem;
    width: auto;
    flex-shrink: 0;
}

.footer-text {
    text-align: left;
}

.footer-text p {
    color: var(--gray-700);
    font-size: 0.6875rem;
    margin: 0;
    line-height: 1.4;
}

.footer-text strong {
    color: var(--corporate-black);
    font-weight: 600;
}

.footer-subtitle {
    color: var(--gray-500);
    font-size: 0.625rem;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 640px) {
    body {
        font-size: 0.8125rem;
    }

    .container {
        padding: 0.375rem;
        max-width: 100%;
    }

    .header {
        padding: 0.625rem 0.75rem;
        margin-bottom: 0.5rem;
        border-radius: 0.25rem;
    }

    .header-content {
        gap: 0.625rem;
    }

    .header .logo {
        height: 2rem;
    }

    .header-text h1 {
        font-size: 0.9375rem;
    }

    .subtitle {
        font-size: 0.6875rem;
    }

    .scanner-container,
    .manual-input-container,
    .result-card {
        padding: 0.625rem;
        border-radius: 0.25rem;
    }

    .scanner-header {
        flex-direction: column;
        gap: 0.375rem;
        align-items: flex-start;
    }

    .scanner-header h2 {
        font-size: 0.875rem;
    }

    .btn-switch {
        width: 100%;
        justify-content: center;
        font-size: 0.6875rem;
        padding: 0.3125rem 0.625rem;
    }

    .btn-primary,
    .btn-secondary {
        font-size: 0.75rem;
        padding: 0.4375rem 0.75rem;
    }

    .result-header {
        flex-direction: row;
        text-align: left;
        gap: 0.5rem;
    }

    .result-header h2 {
        font-size: 0.9375rem;
    }

    .result-icon {
        width: 1.75rem;
        height: 1.75rem;
    }

    .result-icon::after {
        font-size: 0.875rem;
    }

    .qr-reader {
        min-height: 150px;
        margin-bottom: 0.375rem;
    }

    .scanner-status {
        padding: 0.3125rem 0.4375rem;
        margin-bottom: 0.375rem;
    }

    .form-group {
        margin-bottom: 0.5rem;
    }

    .form-group label {
        font-size: 0.6875rem;
        margin-bottom: 0.1875rem;
    }

    .form-group input {
        padding: 0.375rem 0.5rem;
        font-size: 0.6875rem;
    }

    .form-group small {
        font-size: 0.625rem;
    }

    .info-item {
        padding: 0.4375rem 0.5rem;
    }

    .info-label {
        font-size: 0.5625rem;
    }

    .info-value {
        font-size: 0.6875rem;
    }

    .divider {
        margin: 0.5rem 0;
        font-size: 0.625rem;
    }

    .footer {
        padding: 0.625rem 0.75rem;
        margin-top: 0.5rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .footer-logo {
        height: 1.75rem;
    }

    .footer-text {
        text-align: center;
    }

    .footer-text p {
        font-size: 0.625rem;
    }
}

@media (max-width: 380px) {
    .container {
        padding: 0.25rem;
    }

    .header .logo {
        height: 1.75rem;
    }

    .header-text h1 {
        font-size: 0.875rem;
    }

    .qr-reader {
        min-height: 130px;
    }

    .btn-primary,
    .btn-secondary {
        font-size: 0.6875rem;
        padding: 0.375rem 0.625rem;
    }

    .footer-logo {
        height: 1.5rem;
    }
}
