/* Admin Panel Styles */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --text-color: #333;
    --text-light: #666;
    --bg-light: #f5f5f5;
    --border-color: #e0e0e0;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --accent-color: #667eea;
    --transition: all 0.3s ease;
}

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

body.admin-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-light);
    color: var(--text-color);
    line-height: 1.6;
}

.admin-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.admin-sidebar {
    width: 260px;
    min-width: 260px;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.sidebar-header h2 {
    font-size: 20px;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.nav-section-title {
    padding: 15px 20px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 1px;
    margin-top: 10px;
}

.nav-section-title:first-child {
    margin-top: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    width: 100%;
    box-sizing: border-box;
}

.nav-item:hover {
    background: var(--bg-light);
    border-left-color: var(--primary-color);
}

.nav-item.active {
    background: var(--bg-light);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.nav-item i {
    margin-right: 12px;
    width: 20px;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 10px 0;
}

.admin-main {
    margin-left: 260px;
    flex: 1;
    padding: 30px;
    min-height: 100vh;
    width: calc(100% - 260px);
    box-sizing: border-box;
}

.admin-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header Bar */
.admin-header-bar {
    margin-bottom: 30px;
}

.admin-header-bar h1 {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 5px;
}

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

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

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

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

.stat-info {
    flex: 1;
}

.stat-info h3 {
    font-size: 28px;
    margin: 0;
    color: var(--text-color);
}

.stat-info p {
    color: var(--text-light);
    margin: 5px 0 0 0;
    font-size: 14px;
}

.stat-link {
    position: absolute;
    bottom: 10px;
    right: 15px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}

/* Actions Grid */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.action-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-decoration: none;
    color: var(--text-color);
    text-align: center;
    transition: var(--transition);
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.action-card i {
    font-size: 40px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.action-card h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.action-card p {
    color: var(--text-light);
    font-size: 14px;
    margin: 0;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-success, .btn-danger {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

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

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

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

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

/* Forms */
.admin-form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fix for excerpt and other text fields - ensure text wraps */
input[type="text"].form-control,
textarea.form-control {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

/* Excerpt textarea specific styling */
textarea[name*="excerpt"] {
    min-height: 100px;
    line-height: 1.6;
}

/* Admin form card styling */
.admin-form-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.admin-form-card h2 {
    font-size: 22px;
    color: var(--primary-color);
    margin: 0 0 25px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

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

.admin-form-card .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.admin-form-card .form-group input[type="text"],
.admin-form-card .form-group input[type="url"],
.admin-form-card .form-group textarea,
.admin-form-card .form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    box-sizing: border-box;
}

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

.admin-table-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Small buttons for table actions */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

/* Tables */
.admin-table-wrapper {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

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

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--primary-color);
}

.admin-table tr:hover {
    background: var(--bg-light);
}

.admin-table .text-center {
    text-align: center;
    padding: 30px;
    color: var(--text-light);
}

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

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-error {
    background: #f8d7da;
    color: #721c24;
}

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

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Button Groups */
.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Image Upload Styles */
.image-upload-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.image-preview-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 15px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    object-fit: contain;
}

.remove-image-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.remove-image-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.image-upload-controls {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.image-upload-controls .btn-primary {
    white-space: nowrap;
    flex-shrink: 0;
}

.image-upload-controls .form-control {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
    }
    
    .admin-main {
        margin-left: 0;
        padding: 20px;
    }
    
    .stats-grid,
    .actions-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-table-wrapper {
        overflow-x: auto;
    }
}
