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

:root {
    --primary: #027ABB;
    --primary-dark: #015EA0;
    --green: #81d742;
    --green-dark: #44a019;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.5;
    overflow-x: hidden;
}

.admin-login-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    text-decoration: none;
    backdrop-filter: blur(4px);
    transition: background 0.2s, transform 0.2s;
}

.admin-login-btn:hover {
    background: rgba(255, 255, 255, 0.32);
    transform: scale(1.05);
}

.bg-watermark {
    position: fixed;
    inset: -50%;
    z-index: 0;
    pointer-events: none;
    background-repeat: repeat;
    background-image: none;
    background-size: 120px auto;
    transform: rotate(30deg);
    opacity: 0.3;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.logo {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: var(--shadow-lg);
    padding: 15px;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 0.85rem;
    opacity: 0.85;
    font-style: italic;
}

.search-section {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.input-wrapper {
    display: flex;
    gap: 12px;
}

.input-wrapper input {
    flex: 1;
    padding: 14px 16px;
    font-size: 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 122, 187, 0.1);
}

.input-wrapper input::placeholder {
    color: var(--gray-400);
}

.btn-track {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--green);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn-track:hover {
    background: var(--green-dark);
}

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

.btn-track:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
}

.loading {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading p {
    color: var(--gray-600);
    font-size: 0.95rem;
}

.error-state {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.error-state svg {
    color: var(--danger);
    margin-bottom: 16px;
}

.error-state p {
    color: var(--gray-600);
    font-size: 0.95rem;
}

.result-section {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.student-info {
    padding: 16px 20px;
    background: var(--primary);
    color: white;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
}

.info-row .value {
    font-weight: 600;
    font-size: 0.85rem;
}

.info-row.krs-row {
    background: rgba(255,255,255,0.15);
    margin: 8px -20px -16px;
    padding: 12px 20px;
    border-radius: 0 0 8px 8px;
}

.info-row.krs-row .value {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.info-row.krs-row .value.status-sudah {
    background: rgba(22, 163, 74, 0.2);
    color: #86efac;
    border: 1px solid rgba(134, 239, 172, 0.4);
}

.info-row.krs-row .value.status-belum {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(252, 165, 165, 0.4);
}

.requirements-title {
    padding: 12px 20px 6px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
}

.requirements-grid {
    padding: 4px 16px 12px;
    display: grid;
    gap: 4px;
}

.requirement-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--gray-100);
    background: var(--gray-50);
    transition: all 0.2s;
}

.requirement-card.passed {
    background: #f0fdf4;
    border-color: #bbf7d0;
    border-left: 3px solid var(--success);
}

.requirement-card.failed {
    background: #fef2f2;
    border-color: #fecaca;
    border-left: 3px solid var(--danger);
}

.req-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-200);
    color: var(--gray-500);
    flex-shrink: 0;
}

.requirement-card.passed .req-icon {
    background: var(--success);
    color: white;
}

.requirement-card.failed .req-icon {
    background: var(--danger);
    color: white;
}

.req-info {
    flex: 1;
    min-width: 0;
}

.req-name {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.85rem;
}

.req-status {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 1px;
}

.requirement-card.passed .req-status {
    color: var(--success);
}

.requirement-card.failed .req-status {
    color: var(--danger);
}

.req-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: bold;
}

.requirement-card.passed .req-check {
    background: var(--success);
    color: white;
}

.requirement-card.passed .req-check::after {
    content: '\2713';
}

.requirement-card.failed .req-check {
    background: var(--danger);
    color: white;
}

.requirement-card.failed .req-check::after {
    content: '\2717';
}

.final-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin: 0 12px 12px;
    border-radius: 8px;
    border: 1px solid;
}

.final-status.passed {
    background: #f0fdf4;
    color: #166534;
    border-color: #86efac;
}

.final-status.failed {
    background: #fefce8;
    color: #854d0e;
    border-color: #fde047;
}

.final-status.pending {
    background: #eff6ff;
    color: #1e40af;
    border-color: #93c5fd;
}

.final-status .wa-contact {
    margin-left: auto;
}

.final-status .wa-btn {
    background: #1e40af;
}

.final-status .wa-btn:hover {
    background: #1e3a8a;
}

.status-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    background: rgba(255,255,255,0.8);
    border: 2px solid currentColor;
}

.status-icon::after {
    font-size: 18px;
}

.final-status.passed .status-icon::after {
    content: '\2713';
}

.final-status.failed .status-icon::after {
    content: '\26A0';
}

.final-status.pending .status-icon::after {
    content: '\23F3';
}

.status-text {
    flex: 1;
}

.status-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-desc {
    display: block;
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 1px;
}

.history-section {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.history-header h2 {
    font-size: 1rem;
    color: var(--gray-800);
}

.history-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(2, 122, 187, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

.history-time {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-500);
    min-width: 60px;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-info .h-nim {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-800);
}

.history-info .h-device {
    font-size: 0.7rem;
    color: var(--gray-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-status {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
}

.history-status.success {
    background: var(--success-bg);
    color: var(--success);
}

.history-status.pending {
    background: var(--warning-bg);
    color: #b45309;
}

.history-status.failed {
    background: var(--danger-bg);
    color: var(--danger);
}

.history-empty {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.85rem;
    padding: 16px 0;
}

.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
}

.footer p {
    margin-bottom: 5px;
}

.footer strong {
    color: white;
}

.footer .copyright {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-size: 0.75rem;
    opacity: 0.7;
}

.wa-contact {
    margin-left: auto;
}

.wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #25D366;
    color: white;
    border-radius: 16px;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}

.wa-btn:hover {
    background: #128C7E;
}

.wa-btn svg {
    flex-shrink: 0;
}

.wa-text {
    line-height: 1;
}

.krs-web-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 12px;
    transition: background 0.2s;
}

.krs-web-btn:hover {
    background: var(--primary-dark);
}

.hidden {
    display: none !important;
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .logo {
        width: 100px;
        height: 100px;
    }

    .input-wrapper {
        flex-direction: column;
    }

    .btn-track {
        justify-content: center;
    }

    .student-info {
        padding: 16px;
    }

    .requirements-grid {
        padding: 4px 12px 10px;
    }

    .requirement-card {
        padding: 6px 10px;
    }

    .req-icon {
        width: 24px;
        height: 24px;
    }

    .final-status {
        margin: 0 10px 10px;
        padding: 12px;
    }
}
