/* สไตล์สำหรับระบบลงทะเบียนผู้ป่วย */

:root {
    --primary-color: #2c5aa0;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Sarabun', 'Prompt', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

/* Header Styles */
.header {
    text-align: center;
    padding: 30px 0;
    border-bottom: 3px solid var(--primary-color);
    margin-bottom: 30px;
}

.header h1 {
    color: var(--primary-color);
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: bold;
}

.header .subtitle {
    color: #7f8c8d;
    font-size: 1.2em;
}

.logo {
    max-width: 120px;
    margin-bottom: 20px;
}

/* Navigation */
.nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.nav a {
    text-decoration: none;
    padding: 12px 30px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.nav a:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Form Styles */
.form-section {
    background: var(--light-bg);
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.form-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h2::before {
    content: "📋";
    font-size: 1.2em;
}

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

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95em;
}

.form-group label .required {
    color: var(--danger-color);
    margin-left: 3px;
}

.form-control {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    font-family: 'Sarabun', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

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

select.form-control {
    cursor: pointer;
}

/* File Upload Styles */
.file-upload {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: var(--white);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #7f8c8d;
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background: var(--light-bg);
}

.file-upload-label::before {
    content: "📎";
    font-size: 1.5em;
}

/* Button Styles */
.btn {
    padding: 15px 40px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

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

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

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

.btn-success:hover {
    background: #229954;
}

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

.btn-danger:hover {
    background: #c0392b;
}

.btn-container {
    text-align: center;
    margin-top: 30px;
}

/* Alert Messages */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--secondary-color);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background: var(--light-bg);
}

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

/* Action Buttons in Table */
.action-btn {
    padding: 6px 12px;
    margin: 0 3px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    display: inline-block;
    transition: all 0.3s ease;
}

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

.view-btn:hover {
    background: #2980b9;
}

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

.edit-btn:hover {
    background: #e67e22;
}

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

.delete-btn:hover {
    background: #c0392b;
}

/* Card Styles for Patient Details */
.card {
    background: var(--white);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    background: var(--primary-color);
    color: var(--white);
    padding: 15px 20px;
    margin: -25px -25px 20px -25px;
    border-radius: 10px 10px 0 0;
    font-size: 1.3em;
    font-weight: 600;
}

.info-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.info-label {
    font-weight: 600;
    color: var(--text-dark);
}

.info-value {
    color: #555;
}

/* Image Preview */
.image-preview {
    max-width: 300px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 10px 0;
}

/* Search Box */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    max-width: 500px;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1em;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination a {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.pagination a:hover,
.pagination a.active {
    background: var(--primary-color);
    color: var(--white);
}

/* Stats Cards */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 1em;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .info-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    table {
        font-size: 0.9em;
    }
    
    .nav {
        flex-direction: column;
    }
    
    .nav a {
        width: 100%;
    }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
}

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

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    color: #7f8c8d;
}
