/* CSS Variables for Dynamic Styling */
:root {
    --bg-primary: #051424;
    --bg-card: rgba(12, 28, 48, 0.85);
    --border-color: rgba(255, 255, 255, 0.12);
    --border-focus: #38bdf8;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --accent-maroon: #8b002e;
    --accent-gold: #fbbf24;
    --accent-gold-gradient: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
    --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    --font-bengali: 'Hind Siliguri', 'Anek Bangla', sans-serif;
}

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

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(11, 34, 56, 0.9) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 24, 43, 0.95) 0px, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-bengali);
    min-height: 100vh;
    padding-bottom: 2rem;
}

.app-container {
    max-width: 1650px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

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

.logo-icon {
    font-size: 2.2rem;
    color: #fbbf24;
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.4));
}

.logo-text h1 {
    font-size: 1.6rem;
    font-weight: 700;
}

.logo-text h1 span {
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.2rem;
}

.logo-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.header-badge {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Main Workspace Grid */
.workspace {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .workspace {
        grid-template-columns: 1fr;
    }
}

/* Left Controls Panel */
.controls-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.controls-panel::-webkit-scrollbar {
    width: 6px;
}
.controls-panel::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 3px;
}

.control-group {
    background: rgba(8, 20, 36, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.2rem;
}

.control-group h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #38bdf8;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-bottom: 1px dashed rgba(56, 189, 248, 0.2);
    padding-bottom: 0.5rem;
}

/* Template Selector Buttons */
.template-selector-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.template-select-btn {
    background: rgba(15, 30, 50, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-family: var(--font-bengali);
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.template-select-btn i {
    font-size: 1.1rem;
    color: #94a3b8;
}

.template-select-btn:hover {
    border-color: #fbbf24;
    background: rgba(15, 30, 50, 0.95);
    color: #ffffff;
}

.template-select-btn.active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.25) 100%);
    border-color: #fbbf24;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
}

.template-select-btn.active i {
    color: #fbbf24;
}

/* Font Selector Select Box */
.font-select {
    background: rgba(5, 16, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.7rem 0.85rem;
    color: #fbbf24;
    font-family: var(--font-bengali);
    font-size: 0.95rem;
    font-weight: 600;
    width: 100%;
    outline: none;
    cursor: pointer;
}

.font-select option {
    background: #091a2e;
    color: #ffffff;
}

/* Photo Upload Controls */
.file-upload-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(14, 165, 233, 0.3) 100%);
    border: 2px dashed #38bdf8;
    color: #38bdf8;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.file-label:hover {
    background: rgba(56, 189, 248, 0.35);
    color: #ffffff;
    border-color: #7dd3fc;
}

.photo-controls {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.9rem;
    border-radius: 8px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.slider-group input[type="range"] {
    width: 100%;
    accent-color: #38bdf8;
    cursor: pointer;
}

.reset-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-bengali);
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Input Fields */
.input-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.input-field:last-child {
    margin-bottom: 0;
}

.input-field label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-field input {
    background: rgba(5, 16, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    color: #ffffff;
    font-family: var(--font-bengali);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-field input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* Download Button */
.download-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.download-btn {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: 1px solid #38bdf8;
    border-radius: 12px;
    padding: 1.1rem 1.5rem;
    font-family: var(--font-bengali);
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(2, 132, 199, 0.6);
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
}

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

.download-note {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
}

/* Preview Panel */
.preview-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.preview-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.8rem;
}

.preview-header h2 {
    font-size: 1.15rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-hints {
    font-size: 0.82rem;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 9999px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

/* Canvas Wrapper 1:1 Square Ratio */
.canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 650px;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(56, 189, 248, 0.3);
    background: #06182b;
}

#cardCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

#cardCanvas:active {
    cursor: grabbing;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #059669;
    color: #ffffff;
    padding: 0.9rem 1.4rem;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 999;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}
