/* Image Editor Styles */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Canvas Container */
.canvas-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    height: 84%;
    display: flex;
    flex-direction: column;
}

#canvas-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 600px;
    height: 100%;
    background: #f8f9fa;
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
    flex: 1;
    /* Set aspect ratio for social media sharing (1.91:1 for Facebook/Twitter) */
    aspect-ratio: 1.91 / 1;
    max-height: 70vh;
}

#stage-container {
    display: block;
    margin: 0;
    padding: 0;
    width: 100% !important;
    height: 100% !important;
}

.canvas-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Sidebar */
.sidebar {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    height: 84%;
    max-height: none;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    flex: 1;
}

.section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.section h5 {
    color: #ffffff;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Main row container */
.editor-row {
    min-height: 700px;
    align-items: stretch;
}

.editor-row > .col-md-9,
.editor-row > .col-md-3 {
    display: flex;
    flex-direction: column;
}

/* Background Section */
.background-section {
    margin-bottom: 20px;
}

.background-section h4 {
    margin-bottom: 5px;
    color: #ffffff;
}

.background-section small {
    display: block;
    margin-bottom: 10px;
    color: #666;
    font-style: italic;
}

/* Background Grid Container */
.background-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    height: 540px; /* Increased height to show more images */
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    position: relative;
}

/* Custom scrollbar styling */
.background-grid::-webkit-scrollbar {
    width: 8px;
}

.background-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.background-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.background-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add a subtle shadow at the bottom to indicate more content */
.background-grid::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(transparent, rgba(250, 250, 250, 0.9));
    pointer-events: none;
    z-index: 1;
    display: var(--scroll-indicator, block);
}

.bg-item {
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
}

.bg-item:hover {
    border-color: #007bff;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.bg-item img {
    height: 90px; /* Increased image height */
    object-fit: cover;
    border-radius: 4px;
    width: 100%;
}

.bg-item.active {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.3);
}

/* Form Controls */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #ffffff;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

/* Range Sliders */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
}

/* Color Picker */
input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
    transform: translateY(-1px);
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #1e7e34;
    transform: translateY(-1px);
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Share Buttons */
.share-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.share-buttons .btn {
    flex: 1;
    min-width: 80px;
}

/* Loading Indicator */
#loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Toast Notifications */
.toast-container {
    z-index: 9999;
}

.toast {
    min-width: 300px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container-fluid {
        padding: 10px;
    }
    
    .canvas-container {
        padding: 15px;
        height: auto;
        min-height: 60vh;
    }
    
    #canvas-wrapper {
        min-height: 400px;
        aspect-ratio: 1.91 / 1;
        max-height: 50vh;
        width: 100%;
    }
    
    .sidebar {
        margin-top: 15px;
        height: auto;
        max-height: 40vh;
    }
    
    .background-grid {
        grid-template-columns: repeat(3, 1fr);
        height: 350px;
    }
    
    .share-buttons {
        flex-direction: column;
    }
    
    .share-buttons .btn {
        margin-bottom: 10px;
    }
}

@media (max-width: 576px) {
    .background-grid {
        grid-template-columns: repeat(3, 1fr);
        height: 350px;
    }
    
    .canvas-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .canvas-controls .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    #canvas-wrapper {
        min-height: 300px;
        aspect-ratio: 1.91 / 1;
        max-height: 40vh;
    }
    
    .sidebar {
        max-height: 35vh;
    }
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation for background items */
.bg-item {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover effects for controls */
.form-control:hover {
    border-color: #007bff;
}

.btn:active {
    transform: translateY(0);
}

/* Focus states for accessibility */
.btn:focus,
.form-control:focus,
input[type="color"]:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .canvas-container,
    .sidebar {
        background: #4F4F4F;
        color: #ffffff;
    }
    
    .form-control {
        background: #3d3d3d;
        border-color: #555;
        color: #ffffff;
    }
    
    .form-control:focus {
        border-color: #007bff;
    }
}

@font-face {
    font-family: 'UthmanTaha';
    src: url('../fonts/Uthman-TN-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Quran Controls Styling */
.quran-controls {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.quran-controls .dropdown-group {
    margin-bottom: 15px;
}

.quran-controls .dropdown-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: block;
    font-size: 0.9rem;
}

.quran-controls .form-select {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 0.9rem;
    background-color: white;
    width: 100%;
    min-height: 40px;
}

.quran-controls .form-select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Ensure proper spacing between columns */
.quran-controls .row {
    margin-left: -10px;
    margin-right: -10px;
}

.quran-controls .col-md-4 {
    padding-left: 10px;
    padding-right: 10px;
}

@media (max-width: 768px) {
    .quran-controls .col-md-4 {
        margin-bottom: 15px;
    }
} 