:root {
    --bg-color: #f4f4f9;
    --container-bg: white;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #bdc3c7;
    --input-bg: white;
    --tab-bg: #ecf0f1;
    --panel-bg: #f8f9fa;
}

body.dark-mode {
    --bg-color: #1a1a2e;
    --container-bg: #16213e;
    --text-primary: #e9e9eb;
    --text-secondary: #a0a0a0;
    --border-color: #0f3460;
    --input-bg: #1a1a2e;
    --tab-bg: #0f3460;
    --panel-bg: #111a2f;
}

* {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px;
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    background: var(--container-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-align: center;
    max-width: 500px; 
    width: 100%;
    transition: background-color 0.3s;
}

.app-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
h1 { color: var(--text-primary); margin: 0; }
#theme-toggle { background: var(--tab-bg); color: var(--text-primary); width: auto; padding: 8px 12px; font-size: 12px; }
p { color: var(--text-secondary); margin-bottom: 20px; font-size: 15px; }

.tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.tab-btn { background-color: var(--tab-bg); color: var(--text-secondary); flex: 1; padding: 10px; border-radius: 6px; font-size: 14px; transition: background-color 0.3s, color 0.3s; border: none; cursor: pointer; }
.tab-btn.active { background-color: #3498db; color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.input-group { display: flex; gap: 10px; margin-bottom: 15px; }
input[type="text"], select { background-color: var(--input-bg); color: var(--text-primary); border: 2px solid var(--border-color); }
input[type="text"] { width: 100%; padding: 12px; margin-bottom: 15px; border-radius: 6px; font-size: 16px; outline: none; transition: border-color 0.3s, background-color 0.3s, color 0.3s; }
input[type="text"]:focus, select:focus { border-color: #3498db; }

.design-panel {
    background: var(--panel-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.design-panel h3 { margin-top: 0; margin-bottom: 15px; font-size: 16px; text-align: left; }

.design-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.control-group { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.control-group label { font-size: 13px; font-weight: bold; }
select { width: 100%; padding: 8px; border-radius: 6px; font-size: 14px; cursor: pointer; }

input[type="color"] { border: none; width: 100%; height: 35px; padding: 0; border-radius: 6px; cursor: pointer; background: none; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 2px solid var(--border-color); border-radius: 6px; }

.logo-upload-area { display: flex; gap: 10px; justify-content: center; margin-top: 15px; }
.upload-btn { background-color: #9b59b6; color: white; padding: 10px 15px; border-radius: 6px; font-size: 14px; font-weight: bold; cursor: pointer; transition: 0.3s; width: 100%; text-align: center; }
.upload-btn:hover { background-color: #8e44ad; }

button { background-color: #3498db; color: white; border: none; padding: 12px 20px; font-size: 16px; font-weight: bold; border-radius: 6px; cursor: pointer; width: 100%; transition: background-color 0.3s; }
button:hover { background-color: #2980b9; }

.clear-btn { background-color: #e74c3c; width: auto; padding: 0 15px; }
.clear-btn:hover { background-color: #c0392b; }

#qr-code { margin-top: 25px; display: flex; justify-content: center; background: white; padding: 15px; border-radius: 8px; display: none; }
#qr-code canvas { max-width: 100%; height: auto; border-radius: 4px; } 

#download-btn { background-color: #27ae60; margin-top: 20px; display: none; }
#download-btn:hover { background-color: #2ecc71; }

.seo-section { max-width: 600px; width: 100%; margin-top: 40px; background: var(--container-bg); padding: 30px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); text-align: left; transition: background-color 0.3s; }
.seo-section h2 { margin-top: 0; border-bottom: 2px solid var(--border-color); padding-bottom: 10px; margin-bottom: 20px; }
.faq-item { margin-bottom: 20px; }
.faq-item h3 { font-size: 16px; margin-bottom: 5px; }
.faq-item p { color: var(--text-secondary); margin-top: 0; font-size: 14px; line-height: 1.6; }

footer { margin-top: 40px; padding: 20px; text-align: center; width: 100%; color: var(--text-secondary); font-size: 14px; border-top: 1px solid var(--border-color); transition: color 0.3s, border-color 0.3s; }

/* TOAST NOTIFICATIONS */
#toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%); 
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000; 
    pointer-events: none; 
}

.toast {
    background-color: #34495e;
    color: white;
    padding: 12px 24px;
    border-radius: 50px; 
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { background-color: #27ae60; }
.toast.error { background-color: #e74c3c; }
.toast.info { background-color: #3498db; }

/* HISTORY STYLING */
#history-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: left;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.history-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

#clear-history-btn {
    background: transparent;
    color: #e74c3c;
    border: none;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    width: auto;
    padding: 0;
}

#history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: var(--panel-bg);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.history-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.history-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.history-tag {
    font-size: 10px;
    background: #3498db;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* PRINT POSTER STYLING (FIXED LAYOUT) */
#print-area { display: none; }

@media print {
    @page {
        margin: 0; 
        size: auto; 
    }

    body {
        background-color: white !important;
        margin: 0;
        padding: 0;
        display: block;
    }

    .container, .seo-section, footer, #toast-container {
        display: none !important;
    }

    #print-area {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        text-align: center;
        font-family: 'Segoe UI', sans-serif;
        padding: 2cm;
        box-sizing: border-box;
    }

    #print-area h1 {
        font-size: 55px;
        color: #000;
        margin-bottom: 10px;
        text-transform: uppercase;
    }

    .print-instruction {
        font-size: 22px;
        color: #555;
        margin-bottom: 40px;
    }

    #print-qr-img {
        width: 350px; 
        max-width: 100%;
        height: auto;
        margin-bottom: 40px;
        border: 4px solid #000;
        padding: 20px;
        border-radius: 20px;
    }

    .print-details {
        border-top: 2px dashed #ccc;
        padding-top: 30px;
        width: 80%;
    }

    #print-area h2 {
        font-size: 35px;
        color: #000;
        margin: 5px 0;
    }

    #print-area h3 {
        font-size: 25px;
        color: #333;
        margin: 5px 0;
    }
}