* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

:root {
    /* Theme variables */
    --primary-gradient: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    --button-gradient: linear-gradient(45deg, #6C63FF, #FF6584);
    
    /* Light theme */
    --bg-color: #ffffff;
    --text-color: #333333;
    --sidebar-bg: rgba(255, 255, 255, 0.95);
    --tool-bg: #ffffff;
    --input-bg: #ffffff;
    --input-text: #333333;
    --input-border: #cccccc;
    --canvas-bg: #ffffff;
    --canvas-outer-bg: #ffffff;
    --canvas-inner-bg: #f5f5f5;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --sidebar-bg: rgba(33, 33, 33, 0.95);
    --tool-bg: #2d2d2d;
    --input-bg: #333333;
    --input-text: #ffffff;
    --input-border: #444444;
    --canvas-bg: #2d2d2d;
    --canvas-outer-bg: #232323;
    --canvas-inner-bg: #2d2d2d;
}

body * {
    transition: background-color 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.navbar {
    background-color: var(--navbar-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.navbar-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
}

.navbar-icon {
    font-size: 24px;
    color: #ff7f00;
    margin-right: 10px;
    animation: bounce 2s infinite;
    filter: drop-shadow(0 0 5px rgba(255, 127, 0, 0.5));
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.navbar-brand {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(
        to right,
        #ff0000,
        #ff7f00,
        #ffff00,
        #00ff00,
        #0000ff,
        #4b0082,
        #8b00ff
    );
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shine 4s linear infinite;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    letter-spacing: 1px;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.container {
    display: flex;
    padding: 20px;
    gap: 20px;
    margin-top: 90px; /* Increased to account for fixed navbar */
    min-height: calc(100vh - 130px);
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.sidebar {
    width: 300px;
    background-color: var(--sidebar-bg);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    animation: slideIn 0.5s ease;
}

.sidebar-banner-ad {
    margin-bottom: 15px;
    overflow: hidden;
    max-width: 100%;
    text-align: center;
}

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.tool-section {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 10px;
    background-color: var(--tool-bg);
    border: 1px solid var(--input-border);
    transition: all 0.3s ease;
}

.tool-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.tool-section h3 {
    color: var(--text-color);
    margin-bottom: 15px;
    font-size: 16px;
}

.tool-section:first-child::after {
    content: 'Tip: Use arrow keys to move, R to rotate';
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
    font-style: italic;
}

button {
    background: var(--button-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px 0;
    width: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

button:disabled {
    background: #404040;
    color: #666;
    cursor: not-allowed;
}

input, select {
    width: 100%;
    padding: 8px;
    margin: 5px 0;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 5px;
    color: var(--input-text);
}

input::placeholder {
    color: #888;
}

select option {
    background: #404040;
    color: #ffffff;
}

input[type="file"],
input[type="color"],
input[type="number"],
select {
    width: 100%;
    padding: 8px;
    margin: 5px 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

input:focus,
select:focus {
    border-color: #6C63FF;
    outline: none;
}

textarea#textInput {
    width: 100%;
    padding: 8px;
    margin: 5px 0;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 5px;
    color: var(--input-text);
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

textarea#textInput:focus {
    border-color: #6C63FF;
    outline: none;
    box-shadow: 0 0 5px rgba(108, 99, 255, 0.3);
}

.canvas-container {
    flex-grow: 1;
    background-color: var(--canvas-outer-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: visible !important; /* Allow text to overflow container */
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.canvas-container .upper-canvas {
    cursor: move;
}

#canvas {
    border: 1px solid var(--input-border);
    box-shadow: 0 0 20px rgba(0,0,0,0.15);
    background-color: var(--canvas-inner-bg);
}

#stickerGallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
    padding: 5px;
    background: #f5f5f5;
    border-radius: 8px;
}

#stickerGallery img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: #fff;
    border-radius: 4px;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.2s;
}

.sticker {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.sticker:hover {
    transform: scale(1.1);
}

.ai-sticker-controls {
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.ai-sticker-controls input {
    margin-bottom: 10px;
}

#generateSticker {
    background: var(--button-gradient);
    position: relative;
    overflow: hidden;
}

#generateSticker:hover {
    background: #236b31;
}

#generateSticker:disabled {
    background: #666;
    cursor: not-allowed;
}

.loading {
    position: relative;
    overflow: hidden;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 200%; }
}

.processing {
    position: relative;
}

.processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Font Families */
.bangla-text {
    font-family: 'Hind Siliguri', 'Noto Sans Bengali', sans-serif;
}

.hindi-text {
    font-family: 'Tiro Devanagari Hindi', 'Poppins', sans-serif;
}

/* Add support for Bangla and Hindi text in the font selector */
#fontFamily option[value^="Hind"],
#fontFamily option[value^="Noto"],
#fontFamily option[value^="Tiro"] {
    font-size: 16px;
    padding: 8px;
}

.footer {
    background: var(--primary-gradient);
    padding: 20px;
    text-align: center;
    margin-top: 40px;
    border-top: 1px solid #404040;
    margin-top: auto;
    color: white;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    color: #888;
}

.footer-banner-ad {
    margin-bottom: 20px;
    overflow: hidden;
    max-width: 100%;
    text-align: center;
}

.ad-container {
    background: #2d2d2d;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    margin: 10px 0;
}

.top-ad {
    max-width: 1200px;
    margin: 20px auto;
}

.sidebar-ad {
    width: 300px;
    height: 600px;
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

@media (max-width: 1600px) {
    .sidebar-ad {
        display: none;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: auto;
    }
}

/* Update text input styling */
#textInput {
    width: 100%;
    min-height: 60px;
    padding: 10px;
    margin: 5px 0 10px 0;
    background: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--input-border);
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
}

#textInput:focus {
    border-color: #6C63FF;
    outline: none;
    box-shadow: 0 0 5px rgba(108, 99, 255, 0.3);
}

/* Text controls styling */
.tool-section input[type="color"],
.tool-section input[type="number"],
.tool-section select {
    margin-bottom: 10px;
    background: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--input-border);
}

input[type="file"] {
    width: 100%;
    padding: 8px;
    margin: 5px 0 10px 0;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 5px;
    cursor: pointer;
    color: var(--input-text);
}

input[type="file"]:hover {
    background: #f5f5f5;
    border-color: #999999;
}

input[type="file"]::-webkit-file-upload-button {
    background: var(--button-gradient);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
}

/* Add theme toggle button styles */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--button-gradient);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle i {
    font-size: 20px;
    color: white;
}

#clearCanvas {
    background: linear-gradient(45deg, #FF4B4B, #FF7676);
    margin-top: 10px;
}

#clearCanvas:hover {
    background: linear-gradient(45deg, #FF3333, #FF6060);
    transform: translateY(-2px);
}
