/**
 * Custom styles for eCommerce Admin Dashboard
 */

/* =======================
   Theme and Layout
========================== */
:root {
    --primary-color: #3B82F6;
    --primary-dark: #2563EB;
    --secondary-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;
    --success-color: #10B981;
    --dark-color: #1F2937;
    --light-color: #F9FAFB;
    --gray-color: #E5E7EB;
    --text-color: #374151;
    --text-light: #9CA3AF;
    --border-color: #E5E7EB;
    --sidebar-width: 250px;
    --header-height: 64px;
}

.dark-mode {
    --primary-color: #60A5FA;
    --primary-dark: #3B82F6;
    --secondary-color: #34D399;
    --danger-color: #F87171;
    --warning-color: #FBBF24;
    --info-color: #60A5FA;
    --success-color: #34D399;
    --dark-color: #1F2937;
    --light-color: #111827;
    --gray-color: #374151;
    --text-color: #F9FAFB;
    --text-light: #9CA3AF;
    --border-color: #374151;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    background-color: #F1F5F9;
    transition: background-color 0.3s, color 0.3s;
}

.dark-mode body {
    background-color: #0F172A;
}

.app-container {
    display: grid;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    min-height: 100vh;
}

.app-header {
    grid-area: header;
    background-color: white;
    border-bottom: 1px solid var(--border-color);
}

.dark-mode .app-header {
    background-color: var(--dark-color);
    border-color: var(--border-color);
}

.app-sidebar {
    grid-area: sidebar;
    background-color: white;
    border-right: 1px solid var(--border-color);
}

.dark-mode .app-sidebar {
    background-color: var(--dark-color);
    border-color: var(--border-color);
}

.app-main {
    grid-area: main;
    padding: 1.5rem;
}

.theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 50;
    border: none;
    outline: none;
    transition: background-color 0.3s;
}

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

.login-mode .app-sidebar,
.login-mode .app-header {
    display: none;
}

.login-mode .app-container {
    grid-template-areas: "main";
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.login-mode .app-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* =======================
   Components
========================== */

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: #f9fafb;
    transition: border-color 0.15s ease-in-out;
}

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

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

.form-group .error-message {
    display: block;
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    outline: none;
}

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

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

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

.btn-danger:hover {
    background-color: #DC2626;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: var(--gray-color);
}

.btn-icon {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: 0.375rem;
}

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

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

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

.data-table th {
    font-weight: 600;
    background-color: #F8FAFC;
}

.dark-mode .data-table th {
    background-color: #1E293B;
}

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

.dark-mode .data-table tbody tr:hover {
    background-color: #1E293B;
}

.data-table .actions {
    display: flex;
    gap: 0.5rem;
}

/* Dashboard Cards */
.dashboard-card {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.dark-mode .dashboard-card {
    background-color: var(--dark-color);
}

/* Pagination */
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.375rem;
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
}

.dark-mode .pagination-btn {
    background-color: var(--dark-color);
}

.pagination-btn:hover:not(.disabled) {
    background-color: var(--gray-color);
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.375rem;
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
}

.dark-mode .pagination-page {
    background-color: var(--dark-color);
}

.pagination-page:hover:not(.active) {
    background-color: var(--gray-color);
}

.pagination-page.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    position: relative;
    margin: 1rem auto;
}

.double-bounce1, .double-bounce2 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--primary-color);
    opacity: 0.6;
    position: absolute;
    top: 0;
    left: 0;
    animation: sk-bounce 2.0s infinite ease-in-out;
}

.double-bounce2 {
    animation-delay: -1.0s;
}

@keyframes sk-bounce {
    0%, 100% { 
        transform: scale(0.0);
    } 50% { 
        transform: scale(1.0);
    }
}

/* Order Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.paid {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-badge.fulfilled {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.status-badge.canceled {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.status-badge.pending {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

/* Product Thumbnail */
.product-thumb {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background-color: var(--gray-color);
    display: inline-block;
}

/* Customer Details */
.customer-details p {
    margin-bottom: 0.5rem;
}

.customer-details p strong {
    font-weight: 600;
    display: inline-block;
    width: 120px;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast {
    min-width: 250px;
    max-width: 350px;
    opacity: 0;
}

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

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

.toast-info {
    background-color: var(--info-color);
}

.toast-warning {
    background-color: var(--warning-color);
}

/* Modal */
#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

#modal-container.hidden {
    display: none;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.modal-content-wrapper {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-content {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 1.5rem;
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 10001;
    position: relative;
}

.modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-body {
    margin-bottom: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.modal-form-submit,
.modal-cancel {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
}

.modal-form-submit {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.modal-form-submit:hover {
    background-color: var(--primary-dark);
}

.modal-cancel {
    background-color: #e5e7eb;
    color: #374151;
    border: none;
}

.modal-cancel:hover {
    background-color: #d1d5db;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .app-container {
        grid-template-areas:
            "header"
            "main";
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-height) 1fr;
    }
    
    .app-sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        bottom: 0;
        width: var(--sidebar-width);
        z-index: 10;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .app-sidebar.show {
        transform: translateX(0);
    }
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.login-container h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

/* Image Preview */
.image-preview {
    width: 100px;
    height: 100px;
    border-radius: 0.375rem;
    object-fit: cover;
    border: 1px solid #d1d5db;
}

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Customer Details */
.customer-detail {
    margin-bottom: 1rem;
}

.customer-detail-label {
    font-weight: 500;
    color: #6b7280;
}

.customer-detail-value {
    color: #1f2937;
}

/* Order Details */
.order-items {
    margin-top: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    overflow: hidden;
}

.order-item {
    display: flex;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.order-item:last-child {
    border-bottom: none;
}

.order-item-image {
    width: 60px;
    height: 60px;
    border-radius: 0.25rem;
    object-fit: cover;
}

.order-item-details {
    margin-left: 1rem;
    flex: 1;
}

.order-item-name {
    font-weight: 500;
    color: #1f2937;
}

.order-item-price,
.order-item-quantity {
    color: #6b7280;
    font-size: 0.875rem;
}

.order-total {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background-color: #f3f4f6;
    font-weight: 500;
    color: #1f2937;
}

/* Dark Mode (Optional) */
.dark-mode {
    background-color: #1f2937;
    color: #f9fafb;
}

.dark-mode .dashboard-card,
.dark-mode .login-container {
    background-color: #374151;
    color: #f9fafb;
}

.dark-mode .data-table thead th {
    background-color: #4b5563;
    color: #f9fafb;
}

.dark-mode .data-table th,
.dark-mode .data-table td {
    border-bottom: 1px solid #4b5563;
}

.dark-mode .data-table tbody tr:hover {
    background-color: #374151;
}

.dark-mode .form-group label {
    color: #e5e7eb;
}

.dark-mode .form-group input,
.dark-mode .form-group select,
.dark-mode .form-group textarea {
    background-color: #4b5563;
    border-color: #6b7280;
    color: #f9fafb;
}

.dark-mode .btn-outline {
    border-color: #6b7280;
    color: #e5e7eb;
}

.dark-mode .btn-outline:hover {
    background-color: #4b5563;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #374151;
    color: #f9fafb;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 10;
    transition: background-color 0.2s ease-in-out;
}

.dark-mode .theme-toggle {
    background-color: #f9fafb;
    color: #374151;
}

/* =======================
   Trix Editor Styles
========================== */
.trix-container {
    margin-bottom: 1rem;
}

.trix-content {
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    padding: 0.5rem;
}

.dark-mode trix-editor {
    color: #F9FAFB;
    background-color: #374151;
    border-color: #4B5563;
}

.dark-mode .trix-button {
    background-color: #4B5563;
    border-color: #6B7280;
}

.dark-mode .trix-button.trix-active {
    background-color: #3B82F6;
    border-color: #2563EB;
}

.dark-mode .trix-button-group {
    border-color: #6B7280;
}

/* Fix Trix toolbar in dark mode */
.dark-mode trix-toolbar .trix-button-row {
    background-color: #1F2937;
    border-color: #4B5563;
}

.dark-mode trix-toolbar .trix-button--icon {
    filter: invert(1);
}

/* Adjust spacing for better UX */
trix-toolbar {
    padding: 0.5rem 0;
}

/* Responsive adjustments for Trix editor */
@media (max-width: 768px) {
    .trix-content {
        min-height: 150px;
    }
    
    trix-toolbar .trix-button-group {
        margin-bottom: 0.25rem;
    }
} 