/**
 * ================================================================================
 * CO-READIT - Admin Settings Styles
 * ================================================================================
 * 
 * @author      Edu Brazeal
 * @email       chinedu@edubrazeal.com
 * @website     https://edubrazeal.com
 * @company     Rollsrex Ltd
 * @copyright   Copyright (c) 2025 CO-READIT. All rights reserved.
 * @license     Commercial License
 * @version     1.0.0
 * 
 * ================================================================================
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #e2e8f0;
    padding: 1.5rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: #0f172a;
    font-weight: 600;
}

.sidebar-section {
    padding: 1.5rem 0;
}

.sidebar-section-title {
    padding: 0 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

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

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.sidebar-menu li a:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.sidebar-menu li a.active {
    background: #f0fdf4;
    color: #10b981;
    border-left: 3px solid #10b981;
}

.sidebar-menu li a img {
    width: 18px;
    height: 18px;
    filter: brightness(0) saturate(100%) invert(48%) sepia(6%) saturate(629%) hue-rotate(177deg) brightness(94%) contrast(87%);
}

.sidebar-menu li a.active img {
    filter: brightness(0) saturate(100%) invert(65%) sepia(59%) saturate(454%) hue-rotate(95deg) brightness(96%) contrast(91%);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
}

.header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.5rem;
    color: #0f172a;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.header-actions a {
    color: #64748b;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.header-actions a:hover {
    color: #10b981;
}

.header-actions a img {
    width: 16px;
    height: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Section Styles */
.section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.section h2 {
    font-size: 1.25rem;
    color: #0f172a;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section h2 img {
    width: 24px;
    height: 24px;
}

.section-description {
    color: #64748b;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #0f172a;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-group label .required {
    color: #ef4444;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group textarea,
.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-group select,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background-color: white;
    cursor: pointer;
}

.form-group select:focus,
.form-select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

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

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #64748b;
    font-size: 0.75rem;
}

/* File Upload */
.file-upload {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.file-upload:hover {
    border-color: #10b981;
    background: #f0fdf4;
}

.file-upload img {
    width: 24px;
    height: 24px;
    opacity: 0.5;
}

.file-upload:hover img {
    opacity: 0.8;
}

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

.file-preview {
    margin-top: 1rem;
}

.file-preview img {
    max-width: 200px;
    max-height: 100px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.preview-container img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.remove-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.remove-preview:hover {
    background: #dc2626;
}

.file-preview .error {
    color: #ef4444;
    font-size: 0.875rem;
    padding: 0.5rem;
}

.current-file {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: 0.875rem;
}

.current-file-display {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    text-align: center;
}

.current-file-display img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin: 8px 0;
}

.current-file-display p {
    margin: 0.5rem 0;
}

/* Color Picker Styles */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-input {
    width: 50px;
    height: 40px;
    padding: 2px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    background: white;
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-input::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-hex-input {
    flex: 1;
    max-width: 120px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.875rem;
    text-transform: uppercase;
}

.color-hex-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.color-preview-box {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-preview-primary {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    color: white;
    background: var(--preview-primary, #3b82f6);
}

.btn-preview-secondary {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    color: white;
    background: var(--preview-secondary, #10b981);
}

.link-preview-primary {
    color: var(--preview-primary, #3b82f6);
    text-decoration: none;
    font-weight: 500;
}

.link-preview-primary:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn img {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: #10b981;
    color: white;
}

.btn-primary:hover {
    background: #059669;
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.btn-secondary {
    border: none;
    padding: 10px;
    border-radius: 8px;
    background: #10b981;
    color: white;
    margin-left: 0.5rem;
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert img {
    width: 20px;
    height: 20px;
}

.alert-success {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* Utility */
.loading {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Toggle Switch Styles */
.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
}

.toggle-item:hover {
    border-color: #10b981;
    background: #f0fdf4;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #10b981;
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-label {
    flex: 1;
}

.toggle-label strong {
    display: block;
    color: #0f172a;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.toggle-label small {
    display: block;
    color: #64748b;
    font-size: 0.75rem;
}

/* Advertisement Section Styles */
.ad-preview-box {
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    min-height: 250px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 200px;
}

.form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* =============================================================================
   Policy Editor Styles
   ============================================================================= */

.policy-editor-group {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.policy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.policy-header:hover {
    background: #f1f5f9;
}

.policy-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    color: #0f172a;
    margin: 0;
}

.policy-header h3 img {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.policy-toggle-icon {
    font-size: 0.75rem;
    color: #64748b;
    transition: transform 0.2s;
}

.policy-toggle-icon.expanded {
    transform: rotate(180deg);
}

.policy-content {
    padding: 1.25rem;
    border-top: 1px solid #e2e8f0;
    display: none;
}

.policy-content.expanded {
    display: block;
}

.policy-textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 0 0 6px 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 300px;
    background: white;
}

.policy-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.editor-toolbar {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.editor-toolbar button {
    padding: 0.375rem 0.625rem;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    min-width: 32px;
    transition: all 0.2s;
}

.editor-toolbar button:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.editor-toolbar button:active {
    background: #cbd5e1;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
}
