/* AlBurhan (البرہان) Frames - Professional Mobile-First Styling */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #764ba2;
    --accent-color: #667eea;
    --success-color: #059669;
    --danger-color: #dc2626;
    --dark-color: #1f2937;
    --light-bg: #f9fafb;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.3s ease;
}

/* Global Mobile-First Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans Arabic', sans-serif;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Logo Styles */
.brand-logo {
    max-height: 70px;
    width: auto;
    display: inline-block;
    vertical-align: middle;
}

@media (min-width: 768px) {
    .brand-logo {
        max-height: 80px;
    }
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: inherit;
    margin-left: 0.5rem;
    display: inline-block;
    vertical-align: middle;
}

@media (min-width: 768px) {
    .brand-text {
        font-size: 1.5rem;
    }
}

.brand-arabic {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-color);
    -webkit-text-fill-color: var(--accent-color);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    margin-left: 0.25rem;
    opacity: 0.9;
}

@media (min-width: 768px) {
    .brand-arabic {
        font-size: 1.125rem;
    }
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    padding: 1rem;
}

.login-page .card {
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    border: none;
}

.brand-title {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .brand-title {
        font-size: 2.25rem;
    }
}

.brand-subtitle {
    font-size: 1rem;
    color: #6b7280;
    font-weight: 500;
}

/* Admin Page */
.admin-page {
    background: var(--light-bg);
}

/* Navbar Optimizations */
.navbar {
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow);
}

@media (max-width: 767px) {
    .navbar .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Frame Cards */
.frame-card {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
}

.frame-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.frame-thumbnail {
    height: 200px;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.frame-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.share-link-container {
    background: #f3f4f6;
    padding: 8px;
    border-radius: 8px;
}

.share-link {
    font-size: 0.75rem;
    background: white;
}

/* User Page - Frame Editor */
.user-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.canvas-container {
    position: relative;
    background: #f9fafb;
    border-radius: var(--border-radius);
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px dashed #d1d5db;
}

#photoCanvas {
    max-width: 100%;
    max-height: 500px;
    display: none;
    cursor: move;
    border-radius: 8px;
}

#photoCanvas.active {
    display: block;
}

.canvas-placeholder {
    text-align: center;
    padding: 40px;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #d1d5db;
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #dbeafe;
    transform: scale(1.02);
}

/* Controls */
#photoControls .form-range {
    cursor: pointer;
}

#photoControls .form-range::-webkit-slider-thumb {
    background: var(--primary-color);
}

#photoControls .form-range::-moz-range-thumb {
    background: var(--primary-color);
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-success:hover {
    background: #047857;
    transform: translateY(-2px);
}

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

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

/* Loading Overlay */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#loadingOverlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Cards */
.card {
    border-radius: var(--border-radius);
    border: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.frame-card {
    animation: fadeIn 0.5s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .canvas-container {
        min-height: 300px;
    }
    
    #photoCanvas {
        max-height: 300px;
    }
    
    .brand-title {
        font-size: 1.5rem;
    }
    
    .upload-area {
        padding: 20px;
    }
}

/* Navbar */
.navbar-dark {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Form Controls */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Modal */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
}

/* Progress Bar */
.progress {
    border-radius: 8px;
    height: 8px;
}

.progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: var(--shadow);
}

.shadow-lg-custom {
    box-shadow: var(--shadow-lg);
}

/* Multi-Slot Upload Interface */
.slot-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 576px) {
    .slot-upload-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.slot-upload-box {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #f9fafb;
}

@media (min-width: 768px) {
    .slot-upload-box {
        padding: 20px;
        min-height: 180px;
    }
}

.slot-upload-box.has-photo {
    border-color: var(--success-color);
    background: white;
}

/* Stat Cards Mobile Optimization */
.stat-card {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1rem;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

@media (min-width: 768px) {
    .stat-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

/* Frame Cards Mobile Responsive */
@media (max-width: 576px) {
    .frame-card {
        margin-bottom: 1rem;
    }
    
    .frame-thumbnail {
        height: 180px;
    }
}

/* Gallery Page Mobile Optimization */
.gallery-page .gallery-card img {
    height: 200px;
}

@media (max-width: 768px) {
    .gallery-page .gallery-card img {
        height: 180px;
    }
}

@media (min-width: 769px) {
    .gallery-page .gallery-card img {
        height: 250px;
    }
}

/* Touch-Friendly Buttons */
@media (max-width: 767px) {
    .btn {
        min-height: 44px;
        font-size: 0.95rem;
    }
    
    .btn-sm {
        min-height: 36px;
        font-size: 0.875rem;
    }
} 

/* Mobile Form Controls */
@media (max-width: 767px) {
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.625rem 0.75rem;
    }
    
    .form-control-sm {
        font-size: 14px;
        padding: 0.5rem 0.625rem;
    }
}

/* Canvas Container Mobile */
@media (max-width: 576px) {
    .canvas-container {
        min-height: 250px;
        border-radius: var(--border-radius-sm);
    }
    
    #photoCanvas {
        max-height: 250px;
    }
}

/* Upload Area Mobile */
@media (max-width: 576px) {
    .upload-area {
        padding: 1.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .upload-area .display-4 {
        font-size: 2rem;
    }
}

/* Controls Panel Mobile */
@media (max-width: 767px) {
    #photoControls {
        position: sticky;
        bottom: 0;
        background: white;
        z-index: 100;
        border-top: 1px solid #e5e7eb;
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 1rem !important;
        border-radius: 0;
    }
}

/* Table Responsive */
@media (max-width: 767px) {
    .table {
        font-size: 0.875rem;
    }
    
    .table td,
    .table th {
        padding: 0.5rem;
    }
}

/* Card Body Mobile Padding */
@media (max-width: 576px) {
    .card-body {
        padding: 1rem;
    }
}

/* Container Mobile */
@media (max-width: 576px) {
    .container,
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}


.slot-upload-box:hover {
    border-color: var(--primary-color);
    background-color: #eff6ff;
    transform: translateY(-2px);
}

.slot-upload-box.selected {
    border-color: var(--success-color);
    border-width: 3px;
    border-style: solid;
    box-shadow: 0 0 15px rgba(5, 150, 105, 0.3);
}

.slot-upload-box.has-photo {
    border-style: solid;
    border-color: var(--success-color);
}

.slot-upload-content {
    text-align: center;
}

.slot-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.slot-preview img {
    max-width: 100%;
    max-height: 120px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 10px;
}

#currentSlotIndicator {
    margin-bottom: 15px;
    text-align: center;
    font-size: 0.9rem;
}

#currentSlotText {
    font-weight: bold;
    color: var(--success-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .slot-upload-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .slot-upload-box {
        min-height: 150px;
        padding: 15px;
    }
}
