/* ========== Reset & Base Styles ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sarabun', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #f4f6f9;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ========== Login Page ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

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

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.login-footer p {
    font-size: 12px;
    color: #666;
}

/* ========== Header ========== */
.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left .logo {
    font-size: 20px;
    font-weight: bold;
    color: #4e73df;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-role {
    font-size: 12px;
    color: #666;
}

/* ========== Container & Layout ========== */
.container {
    display: flex;
    min-height: calc(100vh - 70px);
}

/* ========== Sidebar ========== */
.sidebar {
    width: 250px;
    background: white;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
}

.nav-menu {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 5px;
}

.nav-menu a {
    display: block;
    padding: 12px 25px;
    color: #333;
    transition: all 0.3s;
}

.nav-menu a:hover {
    background: #f4f6f9;
    color: #4e73df;
    border-left: 3px solid #4e73df;
}

.nav-menu a.active {
    background: #4e73df;
    color: white;
    border-left: 3px solid #2e59d9;
}

/* ========== Main Content ========== */
.main-content {
    flex: 1;
    padding: 30px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    color: #333;
}

.page-header p {
    color: #666;
    font-size: 14px;
}

/* ========== Cards ========== */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.card-header h2 {
    font-size: 18px;
    color: #333;
}

.card-body {
    padding: 20px;
}

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

.stat-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue { background: #e7f0ff; }
.stat-icon.green { background: #d4f4dd; }
.stat-icon.yellow { background: #fff4d4; }
.stat-icon.purple { background: #f3e8ff; }

.stat-info h3 {
    font-size: 32px;
    color: #333;
    margin-bottom: 5px;
}

.stat-info p {
    color: #666;
    font-size: 14px;
}

/* ========== Dashboard Grid ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-grid .card-body {
    height: 300px;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #4e73df;
}

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

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.form-card {
    margin-bottom: 30px;
}

/* ========== Buttons ========== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #4e73df;
    color: white;
}

.btn-primary:hover {
    background: #2e59d9;
}

.btn-success {
    background: #1cc88a;
    color: white;
}

.btn-success:hover {
    background: #17a673;
}

.btn-warning {
    background: #f6c23e;
    color: white;
}

.btn-warning:hover {
    background: #dda20a;
}

.btn-danger {
    background: #e74a3b;
    color: white;
}

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

.btn-secondary {
    background: #858796;
    color: white;
}

.btn-secondary:hover {
    background: #6c757d;
}

.btn-logout {
    background: #e74a3b;
    color: white;
    padding: 8px 16px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

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

/* ========== Tables ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f8f9fc;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.data-table tbody tr:hover {
    background: #f8f9fc;
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-published,
.badge-active {
    background: #d4f4dd;
    color: #1cc88a;
}

.badge-draft {
    background: #fff4d4;
    color: #f6c23e;
}

.badge-archived,
.badge-inactive {
    background: #f0f0f0;
    color: #858796;
}

.badge-admin {
    background: #e7f0ff;
    color: #4e73df;
}

.badge-staff {
    background: #f3e8ff;
    color: #9b59b6;
}

/* ========== Alerts ========== */
.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4f4dd;
    color: #1cc88a;
    border-left: 4px solid #1cc88a;
}

.alert-error {
    background: #ffe5e5;
    color: #e74a3b;
    border-left: 4px solid #e74a3b;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

/* ========== Current Image Preview ========== */
.current-image {
    margin-bottom: 15px;
}

.current-image img {
    display: block;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.current-image p {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* ========== Loading & Animation ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease;
}
