/* ===================================================
   SISTEM PENDAFTARAN PASIEN RSUD
   Stylesheet Utama - Desain Minimalis & Elegan
   =================================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background: #fafaf9;
    min-height: 100vh;
    padding: 0;
    color: #1f2937;
}

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

/* ===================================================
   HEADER
   =================================================== */

header {
    background: white;
    padding: 32px 24px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0;
}

header h1 {
    color: #111827;
    font-size: 26px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

header p {
    color: #6b7280;
    text-align: center;
    font-size: 14px;
    font-weight: 400;
}

/* ===================================================
   MAIN CONTENT
   =================================================== */

.content-wrapper {
    background: white;
    padding: 32px 24px;
    border-radius: 0;
    border: none;
    margin-bottom: 0;
}

/* ===================================================
   BUTTONS
   =================================================== */

.btn {
    display: inline-block;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-primary {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.btn-primary:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
    color: #0284c7;
    box-shadow: 0 2px 4px rgba(3, 105, 161, 0.2);
}

.btn-success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.btn-success:hover {
    background: #bbf7d0;
    border-color: #4ade80;
    color: #166534;
    box-shadow: 0 2px 4px rgba(21, 128, 61, 0.2);
}

.btn-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.btn-warning:hover {
    background: #fef08a;
    border-color: #fccd34;
    color: #b45309;
    box-shadow: 0 2px 4px rgba(180, 83, 9, 0.2);
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fecaca;
    border-color: #fca5a5;
    color: #7f1d1d;
    box-shadow: 0 2px 4px rgba(156, 23, 23, 0.2);
}

.btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #4b5563;
    box-shadow: 0 2px 4px rgba(107, 114, 128, 0.15);
}

.btn-small {
    padding: 8px 14px;
    font-size: 12px;
    margin: 0 4px;
}

/* Action buttons in table */
.btn-action-group {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-action {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-block;
}

.btn-action-view {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.btn-action-view:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
    color: #0284c7;
    box-shadow: 0 2px 4px rgba(3, 105, 161, 0.2);
}

.btn-action-edit {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.btn-action-edit:hover {
    background: #fef08a;
    border-color: #fccd34;
    color: #b45309;
    box-shadow: 0 2px 4px rgba(180, 83, 9, 0.2);
}

.btn-action-delete {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.btn-action-delete:hover {
    background: #fecaca;
    border-color: #fca5a5;
    color: #7f1d1d;
    box-shadow: 0 2px 4px rgba(156, 23, 23, 0.2);
}

.button-group {
    margin: 24px 0;
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

/* ===================================================
   FORMS
   =================================================== */

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

label span.required {
    color: #ef4444;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===================================================
   TABLES
   =================================================== */

.table-responsive {
    overflow-x: auto;
    margin-top: 24px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    min-width: 1200px;
}

thead {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
    font-size: 14px;
    white-space: nowrap;
}

td:last-child {
    white-space: normal;
    text-align: center;
    min-width: 300px;
}

tr:hover {
    background: #fafbfc;
}

/* ===================================================
   ALERTS
   =================================================== */

.alert {
    padding: 14px 16px;
    margin: 20px 0;
    border-radius: 6px;
    border-left: 3px solid;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-left-color: #10b981;
}

.alert-danger {
    background: #fef2f2;
    color: #7f1d1d;
    border-left-color: #ef4444;
}

.alert-warning {
    background: #fffbeb;
    color: #78350f;
    border-left-color: #f59e0b;
}

.alert-info {
    background: #eff6ff;
    color: #0c4a6e;
    border-left-color: #3b82f6;
}

.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.5;
    transition: opacity 0.2s;
    color: inherit;
}

.alert-close:hover {
    opacity: 0.8;
}

/* ===================================================
   PAGINATION
   =================================================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 32px 0;
}

.pagination a,
.pagination span {
    padding: 8px 11px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    text-decoration: none;
    color: #4b5563;
    font-size: 13px;
    transition: all 0.2s;
}

.pagination a:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.pagination .active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* ===================================================
   SEARCH BOX
   =================================================== */

.search-box {
    display: flex;
    gap: 12px;
    margin: 24px 0;
    flex-wrap: wrap;
}

.search-box input {
    flex: 1;
    min-width: 300px;
}

/* ===================================================
   FOOTER
   =================================================== */

footer {
    background: white;
    padding: 20px 24px;
    text-align: center;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
    margin-top: 0;
    font-size: 14px;
}

/* ===================================================
   MODAL
   =================================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.modal-header {
    margin-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 16px;
}

.modal-header h2 {
    color: #111827;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    float: right;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    color: #9ca3af;
    transition: color 0.2s;
    border: none;
    background: none;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #374151;
}

/* ===================================================
   RESPONSIVE
   =================================================== */

@media (max-width: 768px) {
    header h1 {
        font-size: 22px;
    }

    .content-wrapper {
        padding: 20px 24px;
    }

    .button-group {
        justify-content: flex-start;
    }

    .button-group a,
    .button-group button {
        font-size: 13px;
        padding: 8px 14px;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box input {
        min-width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table-responsive {
        font-size: 13px;
    }

    th, td {
        padding: 10px 12px;
    }

    .btn-small {
        padding: 5px 10px;
        font-size: 12px;
    }

    .btn-action {
        padding: 7px 12px;
        font-size: 11px;
    }

    .btn-action-group {
        gap: 4px;
    }

    td:last-child {
        min-width: 280px;
    }
}

/* ===================================================
   UTILITIES
   =================================================== */

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

.mt-20 {
    margin-top: 24px;
}

.mb-20 {
    margin-bottom: 24px;
}

.hidden {
    display: none;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-data {
    text-align: center;
    padding: 48px 24px;
    color: #9ca3af;
    font-size: 15px;
}

.success-message {
    color: #10b981;
    font-weight: 500;
}

.error-message {
    color: #ef4444;
    font-weight: 500;
}
