:root {
    --color-primary: #2d5f3f;
    --color-primary-dark: #1a3a28;
    --color-secondary: #f5f5f5;
    --color-text: #333;
    --color-text-light: #666;
    --color-border: #ddd;
    --color-success: #4caf50;
    --color-danger: #f44336;
    --color-warning: #ff9800;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    background: #fafafa;
}

/* Login Page */
.cms-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: 8px;
    padding: 48px 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 13px;
    text-align: center;
    color: var(--color-text-light);
    margin-bottom: 32px;
    letter-spacing: 0.05em;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text);
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.btn-primary {
    padding: 14px 24px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.3s ease;
}

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

.btn-secondary {
    padding: 10px 20px;
    background: var(--color-secondary);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e8e8e8;
}

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

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

.login-error {
    color: var(--color-danger);
    font-size: 13px;
    text-align: center;
    padding: 12px;
    background: rgba(244, 67, 54, 0.1);
    border-radius: 4px;
}

.login-info {
    margin-top: 24px;
    text-align: center;
    color: var(--color-text-light);
}

/* Dashboard */
.cms-dashboard {
    display: flex;
    min-height: 100vh;
}

.cms-sidebar {
    width: 250px;
    background: var(--color-primary);
    color: white;
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.cms-logo {
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 24px;
}

.cms-logo h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.cms-logo p {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

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

.cms-nav a {
    display: block;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.cms-nav a:hover,
.cms-nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: white;
}

.cms-logout {
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 24px;
}

.cms-logout button {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.cms-logout button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cms-main {
    flex: 1;
    margin-left: 250px;
    padding: 32px 40px;
}

.cms-header {
    margin-bottom: 32px;
}

.cms-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
}

.cms-header p {
    color: var(--color-text-light);
}

.cms-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

/* Table */
.cms-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cms-table table {
    width: 100%;
    border-collapse: collapse;
}

.cms-table thead {
    background: var(--color-secondary);
}

.cms-table th {
    padding: 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text);
}

.cms-table td {
    padding: 16px;
    border-top: 1px solid var(--color-border);
}

.cms-table tbody tr:hover {
    background: #fafafa;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 6px 12px;
    border: none;
    background: var(--color-secondary);
    color: var(--color-text);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: #e0e0e0;
}

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

.btn-icon.delete:hover {
    background: #d32f2f;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text-light);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

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

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-light);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-primary);
}

/* Image Preview */
.image-preview {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cms-table tbody tr {
    animation: fadeIn 0.3s ease;
}

.stat-card {
    animation: fadeIn 0.4s ease;
}

.modal.active .modal-content {
    animation: fadeIn 0.3s ease;
}

/* 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: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Utility classes */
.text-center {
    text-align: center;
}

.text-success {
    color: var(--color-success);
}

.text-danger {
    color: var(--color-danger);
}

.text-warning {
    color: var(--color-warning);
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* Responsive */
@media (max-width: 768px) {
    .cms-sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .cms-main {
        margin-left: 0;
        padding: 24px 16px;
    }
    
    .cms-dashboard {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cms-actions {
        flex-direction: column;
    }
    
    .cms-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 32px 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .cms-table {
        overflow-x: auto;
    }
    
    .cms-table table {
        min-width: 600px;
    }
}
