* {
    direction: ltr;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    min-height: 100vh;
    color: #2d3748;
}

h1 {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
    color: #fff;
    margin: 0;
    padding: 16px 20px;
    text-align: center;
    font-size: 1.5em;
    letter-spacing: -0.5px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.15);
}

h2 {
    color: #1e3a8a;
    font-size: 1.4em;
    margin-bottom: 16px;
    font-weight: 600;
    position: relative;
    padding-bottom: 8px;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, #1e3a8a 0%, #1e40af 100%);
    border-radius: 2px;
}

#add-section, #import-section {
    display: none;
}

#data-section {
    background: #fff;
    margin: 20px auto;
    padding: 24px;
    border-radius: 16px;
    max-width: 1250px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

#data-section h2 {
    color: #1e3a8a;
    font-size: 1.3em;
    margin-bottom: 16px;
}

#data-section > div:first-of-type {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

#data-section > div > button {
    padding: 10px 20px;
    font-size: 0.9em;
    border-radius: 10px;
    min-width: 140px;
    font-weight: 500;
}

input, button {
    margin: 4px;
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-size: 0.9em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input {
    border: 2px solid #e2e8f0;
    background: #f8f9fa;
    color: #2d3748;
}

input:focus {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 5px rgba(102, 126, 234, 0.1);
    outline: none;
}

button {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: #fff;
    cursor: pointer;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
    border: none;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.5s ease;
}

button:hover {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.3);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(-2px);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 16px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    overflow: hidden;
}

th, td {
    border: none;
    padding: 12px 10px;
    text-align: center;
    font-size: 0.85em;
}

th {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8em;
}

tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f4f8;
}

tbody tr:nth-child(odd) {
    background: #f8f9fa;
}

tbody tr:hover {
    background: linear-gradient(90deg, #1e3a8a15 0%, #1e40af15 100%);
    transform: scale(1.01);
}

tbody tr:last-child {
    border-bottom: none;
}

/* Statistics Section */
#stats-section {
    max-width: 1000px;
    margin: 20px auto 0 auto;
    padding: 0 20px;
}

.stats-cards {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.15);
    padding: 20px 24px;
    min-width: 160px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.95em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.5s ease;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 24px rgba(30, 58, 138, 0.25);
}

.stat-card:hover::before {
    top: -20%;
    right: -20%;
}

.stat-icon {
    font-size: 3em;
    margin-bottom: 12px;
    z-index: 1;
}

.stat-title {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.9em;
    opacity: 0.95;
    z-index: 1;
}

.stat-value {
    font-size: 1.8em;
    font-weight: 700;
    z-index: 1;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in-out;
    backdrop-filter: blur(4px);
    padding: 20px;
}

.modal[style*="display: block"],
.modal[style*="display:block"] {
    display: flex !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #fff;
    padding: 28px 24px;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content h2 {
    color: #1e3a8a;
    font-size: 1.3em;
    margin-top: 0;
    margin-bottom: 16px;
    border: none;
    padding-bottom: 0;
    font-weight: 600;
}

.modal-content h2::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #1e3a8a 0%, #1e40af 100%);
    border-radius: 2px;
    margin-top: 8px;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-content input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9em;
    transition: all 0.3s;
    background: #f8f9fa;
    color: #2d3748;
    margin: 0;
}

.modal-content input::placeholder {
    color: #9ca3af;
}

.modal-content input:focus {
    border-color: #1e3a8a;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
    outline: none;
}

.modal-content button {
    width: 100%;
    padding: 12px;
    font-size: 0.95em;
    font-weight: 600;
    margin: 8px 0 0 0;
}

.close {
    position: absolute;
    right: 16px;
    top: 12px;
    font-size: 1.8em;
    font-weight: 300;
    color: #cbd5e0;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.close:hover {
    color: #1e3a8a;
    transform: rotate(90deg);
}

.modal table {
    width: 100%;
    margin-top: 16px;
}

.modal-content table tbody {
    display: block;
    max-height: 50vh;
    overflow-y: auto;
}

.modal-content table thead,
.modal-content table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

/* Success Messages */
p[style*="color:green"] {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    padding: 12px 16px;
    border-radius: 10px;
    text-align: center;
    max-width: 950px;
    margin: 12px auto;
    font-weight: 500;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(21, 128, 61, 0.1);
    border-left: 3px solid #22c55e;
}

p[style*="color:red"] {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #7f1d1d;
    padding: 12px 16px;
    border-radius: 10px;
    text-align: center;
    margin: 12px auto;
    font-weight: 500;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(127, 29, 29, 0.1);
    border-left: 3px solid #ef4444;
    max-width: 950px;
}

p[style*="color:orange"] {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    padding: 12px 16px;
    border-radius: 10px;
    text-align: center;
    margin: 12px auto;
    font-weight: 500;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(146, 64, 14, 0.1);
    border-left: 3px solid #f59e0b;
    max-width: 950px;
}

/* View All Button */
#data-section > div:last-of-type {
    text-align: center;
    margin-top: 20px;
}

#data-section > div:last-of-type button {
    min-width: 160px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 1.3em;
        padding: 12px 16px;
    }

    .stats-cards {
        gap: 12px;
    }

    .stat-card {
        min-width: 130px;
        padding: 16px 14px;
        font-size: 0.85em;
    }

    #data-section {
        padding: 16px 12px;
        margin: 12px;
    }

    .modal-content {
        width: 95%;
        padding: 20px 16px;
    }

    th, td {
        padding: 8px 6px;
        font-size: 0.75em;
    }
}
