:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #fbbf24;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --success-color: #10b981;
    --error-color: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #818cf8; /* Fallback */
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
    header h1 {
        background: linear-gradient(to right, #818cf8, #fbbf24);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        -webkit-text-fill-color: transparent;
    }
}

header p {
    color: var(--text-muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
}

@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Glassmorphism Card Style */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input, .form-group select {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.btn {
    width: 100%;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

.role-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
}

.role-mudur {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.role-danisman {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.amount {
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.bonus-amount {
    color: var(--secondary-color);
    white-space: nowrap;
}

.total-amount {
    font-size: 1.1rem;
    color: #818cf8;
    font-weight: 700;
    white-space: nowrap;
}

.action-btn {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.action-btn:hover {
    opacity: 1;
}

/* Row Input for Collection */
.collection-input {
    width: 120px !important;
    padding: 0.4rem 0.75rem !important;
    font-size: 0.9rem !important;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

tr {
    animation: fadeIn 0.4s ease forwards;
}

/* New Styles for Multi-page support */
.nav-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-color);
    border-radius: 99px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.nav-link:hover {
    background: var(--primary-color);
    color: white;
}

.nav-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.print-btn {
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

.logo-container {
    margin-bottom: 2rem;
}

.main-logo {
    height: 100px;
    width: auto;
}

.full-width {
    grid-column: 1 / -1;
}

/* Login Modal */
#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-card {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

#loginError {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 1rem;
    display: none;
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.5rem;
}

/* History Items */
.history-list {
    margin-top: 1rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary-color);
}

.history-item.advance-item {
    border-left-color: var(--error-color);
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-val {
    font-weight: 600;
}

.clickable-name {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: rgba(99, 102, 241, 0.3);
}

.clickable-name:hover {
    color: var(--primary-color);
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Summary Cards Modernized */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin-bottom: 3rem;
}

@media (max-width: 1200px) {
    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.summary-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.25rem 0.75rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.summary-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.summary-card .icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.summary-card:hover .icon-wrapper {
    transform: rotate(10deg);
}

.summary-card .label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.summary-card .value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Color Themes */
.summary-card.base { border-bottom: 4px solid #818cf8; }
.summary-card.base .icon-wrapper { color: #818cf8; background: rgba(129, 140, 248, 0.1); }

.summary-card.warning { border-bottom: 4px solid var(--secondary-color); }
.summary-card.warning .icon-wrapper { color: var(--secondary-color); background: rgba(251, 191, 36, 0.1); }

.summary-card.success { border-bottom: 4px solid var(--success-color); }
.summary-card.success .icon-wrapper { color: var(--success-color); background: rgba(16, 185, 201, 0.1); }

.summary-card.danger { border-bottom: 4px solid var(--error-color); }
.summary-card.danger .icon-wrapper { color: var(--error-color); background: rgba(239, 68, 68, 0.1); }

.summary-card.primary { border-bottom: 4px solid var(--primary-color); background: linear-gradient(145deg, rgba(99, 102, 241, 0.1), var(--card-bg)); }
.summary-card.primary .icon-wrapper { color: var(--primary-color); background: rgba(99, 102, 241, 0.2); }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .card {
        padding: 1.5rem;
        border-radius: 18px;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        margin-bottom: 2rem;
    }

    .summary-card {
        padding: 1.25rem 1rem;
        border-radius: 20px;
    }

    .summary-card .icon-wrapper {
        width: 45px;
        height: 45px;
        margin-bottom: 0.75rem;
    }

    .summary-card .value {
        font-size: 1.2rem;
    }

    .summary-card .label {
        font-size: 0.75rem;
    }

    /* Table Mobile Improvements */
    .table-container {
        margin: 0 -1rem;
        padding: 0 1rem;
        -webkit-overflow-scrolling: touch;
    }

    th, td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .collection-input {
        width: 80px !important;
    }

    .clickable-name {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
        display: block;
    }

    .modal {
        width: 100%;
        margin: 0;
        border-radius: 24px 24px 0 0;
        position: absolute;
        bottom: 0;
        max-height: 95vh;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .history-val {
        width: 100%;
        text-align: left;
        border-top: 1px solid rgba(255,255,255,0.05);
        padding-top: 0.5rem;
    }

    .action-btn {
        padding: 0.5rem;
    }
}

.loading-spinner {
    text-align: center;
    padding: 1rem;
    color: var(--primary-color);
    font-weight: 500;
    animation: fadeIn 0.5s infinite alternate;
}

@media (max-width: 480px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    @page {
        size: landscape;
        margin: 1cm;
    }

    body {
        background: white !important;
        color: black !important;
        padding: 0;
    }
    
    .nav-actions, .nav-link, .btn, .action-btn, 
    .close-modal, .summary-card:hover, .loading-spinner,
    #loginOverlay {
        display: none !important;
    }

    .card, .summary-card {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        border: 1px solid #eee !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .summary-card .value, .total-amount, .amount, .bonus-amount {
        color: black !important;
    }

    header h1 {
        background: none !important;
        color: black !important;
        -webkit-text-fill-color: black !important;
        margin-top: 1rem;
        font-size: 2rem;
    }

    header p {
        color: #666 !important;
        margin-bottom: 2rem;
    }

    .summary-grid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 0.5rem !important;
        margin-bottom: 2rem !important;
    }

    .summary-card {
        padding: 0.75rem !important;
        border-bottom: 2px solid #ddd !important;
    }

    .summary-card .icon-wrapper {
        display: none !important;
    }

    .summary-card .label {
        font-size: 0.7rem !important;
    }

    .summary-card .value {
        font-size: 1rem !important;
    }

    table {
        color: black !important;
        font-size: 0.9rem !important;
    }

    th, td {
        padding: 0.5rem !important;
        border-color: #eee !important;
    }

    .container {
        max-width: 100% !important;
        width: 100% !important;
    }

    .main-logo {
        height: 60px !important;
    }

    #personnelTable {
        width: 100% !important;
    }
}
