/* Admin Panel Styles */
.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
}

.admin-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.admin-header p {
    margin: 0 0 1.5rem 0;
    font-size: 1.2rem;
    opacity: 0.9;
}

.admin-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.admin-actions button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.btn-primary {
    background: #28a745;
    color: white;
}

.btn-primary:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

.admin-main {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
    margin-bottom: 2rem;
}

.admin-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.admin-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.admin-section h2 {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    margin: 0;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.5rem;
    font-weight: 600;
    color: #495057;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

.admin-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.admin-card h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0.5rem;
}

.setting-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group label {
    font-weight: 500;
    color: #495057;
    font-size: 0.95rem;
}

.setting-group input,
.setting-group select {
    padding: 0.6rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

.setting-group input:focus,
.setting-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.setting-group input[type="range"] {
    background: transparent;
    border: none;
    height: 6px;
}

.setting-group input[type="range"]::-webkit-slider-track {
    background: #dee2e6;
    height: 6px;
    border-radius: 3px;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    background: #007bff;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    border: none;
    appearance: none;
    cursor: pointer;
}

.setting-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.color-preview {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #495057;
    margin-left: 0.5rem;
}

.theme-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.8rem;
}

.theme-preset {
    padding: 0.8rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.theme-preset:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.theme-preset.active {
    border-color: #28a745;
    background: #d4edda;
    color: #155724;
}

/* Section Order Management */
.sortable-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
}

.sortable-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: move;
    transition: all 0.3s ease;
    user-select: none;
}

.sortable-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sortable-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.drag-handle {
    font-size: 1.2rem;
    color: #6c757d;
    margin-right: 1rem;
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.section-name {
    flex: 1;
    font-weight: 500;
    color: #495057;
}

.section-toggle label {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: #6c757d;
    cursor: pointer;
}

.section-toggle input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Preview Section */
.preview-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.preview-section h2 {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    margin: 0;
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.5rem;
    font-weight: 600;
    color: #495057;
}

.preview-container {
    padding: 1.5rem;
}

#livePreview {
    width: 100%;
    height: 500px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
}

.preview-controls {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .admin-main {
        grid-template-columns: 1fr;
    }
    
    .preview-section {
        order: -1;
    }
}

@media (max-width: 768px) {
    .admin-header {
        padding: 1.5rem;
    }
    
    .admin-header h1 {
        font-size: 2rem;
    }
    
    .admin-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .admin-actions button {
        width: 100%;
        max-width: 250px;
    }
    
    .admin-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .theme-presets {
        grid-template-columns: 1fr;
    }
    
    .sortable-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .section-toggle {
        align-self: flex-end;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .admin-section {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .admin-section h2 {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
        color: #e2e8f0;
        border-bottom-color: #4a5568;
    }
    
    .admin-card {
        background: #4a5568;
        border-color: #718096;
    }
    
    .admin-card h3 {
        color: #e2e8f0;
        border-bottom-color: #718096;
    }
    
    .setting-group label {
        color: #e2e8f0;
    }
    
    .setting-group input,
    .setting-group select {
        background: #2d3748;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .color-preview {
        background: #2d3748;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .theme-preset {
        background: #2d3748;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .sortable-item {
        background: #2d3748;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .preview-section {
        background: #2d3748;
        color: #e2e8f0;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Success/Error Messages */
.message {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Font Upload Area */
.font-upload-area {
    border: 2px dashed #007bff;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #f8f9ff;
    transition: all 0.3s ease;
    cursor: pointer;
    margin: 1rem 0;
}

.font-upload-area:hover {
    border-color: #0056b3;
    background: #e7f1ff;
    transform: translateY(-2px);
}

.font-upload-area.dragover {
    border-color: #28a745;
    background: #d4edda;
    transform: scale(1.02);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.upload-placeholder p {
    margin: 0;
    color: #495057;
}

.upload-placeholder strong {
    color: #007bff;
    font-size: 1.1rem;
}

.upload-placeholder small {
    color: #6c757d;
    font-size: 0.85rem;
}

#browseFonts {
    background: none;
    border: none;
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
}

#browseFonts:hover {
    color: #0056b3;
}

.uploaded-fonts {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.font-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
}

.font-item .font-name {
    font-weight: 500;
    color: #495057;
}

.font-item .font-size {
    color: #6c757d;
    font-size: 0.8rem;
}

.font-item .font-preview {
    font-size: 1.1rem;
    color: #007bff;
    margin: 0 1rem;
}

.font-item .remove-font {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.font-item .remove-font:hover {
    background: #c82333;
}

.font-upload-progress {
    margin-top: 1rem;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    height: 6px;
    display: none;
}

.font-upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #28a745);
    transition: width 0.3s ease;
    width: 0%;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}