* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.content {
    padding: 40px;
}

.form-section,
.verify-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.form-section h2,
.verify-section h2,
.results-section h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.5em;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.btn-generate {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    font-size: 1.1em;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.results-section {
    margin-bottom: 30px;
}

.stats {
    background: white;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.stats p {
    margin: 10px 0;
    color: #555;
    font-size: 1.05em;
}

.stats span {
    font-weight: bold;
    color: #667eea;
}

.ids-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.ids-table {
    width: 100%;
    border-collapse: collapse;
}

.ids-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.ids-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
}

.ids-table td {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    color: #333;
}

.ids-table tbody tr:hover {
    background: #f8f9fa;
}

.ids-table code {
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    color: #764ba2;
    font-weight: 500;
}

.btn-copy-single {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    font-size: 0.9em;
}

.btn-copy-single:hover {
    background: #764ba2;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0;
}

.btn-copy,
.btn-download,
.btn-new {
    padding: 12px 25px;
    color: white;
    font-weight: 500;
}

.btn-copy {
    background: #28a745;
}

.btn-copy:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-download {
    background: #17a2b8;
}

.btn-download:hover {
    background: #138496;
    transform: translateY(-2px);
}

.btn-new {
    background: #667eea;
}

.btn-new:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

#errorsList {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 20px;
    border-radius: 5px;
    margin-top: 20px;
}

#errorsList h3 {
    color: #856404;
    margin-bottom: 10px;
}

.error-item {
    color: #856404;
    margin: 8px 0;
    padding: 8px;
    background: white;
    border-radius: 3px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: white;
    border-radius: 5px;
    margin-bottom: 20px;
}

.pagination-controls label {
    font-weight: 500;
    color: #555;
}

.pagination-controls select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: border-color 0.3s;
}

.pagination-controls select:focus {
    outline: none;
    border-color: #667eea;
}

#pageInfo {
    color: #555;
    font-weight: 500;
    margin-left: auto;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 20px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 14px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.3s;
}

.pagination-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.pagination-btn.active {
    background: #667eea;
    color: white;
    font-weight: bold;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.pagination-dots {
    padding: 8px;
    color: #555;
    font-weight: bold;
}

.btn-verify {
    padding: 12px 25px;
    background: #667eea;
    color: white;
    font-weight: 500;
    margin-left: 10px;
}

.btn-verify:hover {
    background: #764ba2;
}

#verify_id {
    width: calc(100% - 140px);
    display: inline-block;
}

.verify-result {
    margin-top: 20px;
    padding: 20px;
    border-radius: 8px;
}

.verify-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    border-radius: 5px;
    padding: 20px;
}

.verify-success h3 {
    margin-bottom: 15px;
    color: #155724;
}

.verify-success p {
    margin: 8px 0;
}

.verify-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    border-radius: 5px;
    padding: 20px;
}

.verify-error h3 {
    margin-bottom: 15px;
    color: #721c24;
}

.verify-error p {
    margin: 8px 0;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: white;
    font-size: 1.2em;
    font-weight: 500;
}

@media (max-width: 768px) {
    .content {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .ids-table th,
    .ids-table td {
        padding: 10px;
        font-size: 0.9em;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-copy,
    .btn-download,
    .btn-new {
        width: 100%;
    }

    .btn-verify {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }

    #verify_id {
        width: 100%;
        margin-bottom: 10px;
    }

    .verify-section .form-group {
        display: flex;
        flex-direction: column;
    }

    .pagination {
        gap: 5px;
    }

    .pagination-btn {
        padding: 6px 10px;
        font-size: 0.85em;
    }

    .pagination-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #pageInfo {
        margin-left: 0;
    }
}

/* CRUD Section Styles */
.crud-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.crud-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 300px;
}

.search-box input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-search,
.btn-reset-search {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-search {
    background: #667eea;
    color: white;
}

.btn-search:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-reset-search {
    background: #6c757d;
    color: white;
}

.btn-reset-search:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.crud-pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crud-pagination-controls label {
    font-weight: 500;
    color: #555;
}

.crud-pagination-controls select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
}

.crud-table-container {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.crud-table {
    width: 100%;
    border-collapse: collapse;
}

.crud-table thead {
    background: #667eea;
    color: white;
}

.crud-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.crud-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
    color: #333;
}

.crud-table tbody tr:hover {
    background: #f8f9fa;
}

.crud-table code {
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #764ba2;
}

.level-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 500;
}

.btn-edit,
.btn-delete {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    margin-right: 5px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.btn-edit i,
.btn-delete i {
    font-size: 1em;
}

.btn-edit {
    background: #17a2b8;
    color: white;
}

.btn-edit:hover {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3);
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.action-buttons-cell {
    white-space: nowrap;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal h2 {
    margin-bottom: 20px;
    color: #333;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

.btn-save,
.btn-cancel,
.btn-delete-confirm {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-save i,
.btn-cancel i,
.btn-delete-confirm i {
    font-size: 1em;
}

.btn-save {
    background: #28a745;
    color: white;
}

.btn-save:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-cancel {
    background: #6c757d;
    color: white;
}

.btn-cancel:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-delete-confirm {
    background: #dc3545;
    color: white;
}

.btn-delete-confirm:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

#deleteAdmissionID {
    color: #dc3545;
    font-family: 'Courier New', monospace;
}

/* Responsive adjustments for CRUD */
@media (max-width: 768px) {
    .crud-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        min-width: 100%;
    }

    .crud-pagination-controls {
        justify-content: space-between;
        width: 100%;
    }

    .crud-table {
        font-size: 0.85em;
    }

    .crud-table th,
    .crud-table td {
        padding: 8px;
    }

    .btn-edit,
    .btn-delete {
        display: block;
        width: 100%;
        margin-bottom: 5px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

