:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --accent-color: #38bdf8;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(15, 23, 42, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, #1e3a8a, transparent),
                      radial-gradient(circle at bottom left, #1e40af, transparent);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 420px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
}

.container {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sidebar-header h3 {
    font-size: 1.25rem;
    color: var(--accent-color);
}

.btn-new {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.project-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.project-card:hover {
    border-color: var(--accent-color);
    background: rgba(30, 41, 59, 1);
}

.project-card h4 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.project-card p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.empty-msg {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 2rem;
}

@media (max-width: 1024px) {
    .app-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-top: 1px solid var(--border-color);
        order: 2; /* Mueve la vista previa al final */
    }
    .container {
        width: 100%;
        padding: 1rem;
        order: 1;
    }
    .grid {
        grid-template-columns: 1fr;
    }
    header h1 {
        font-size: 1.8rem;
    }
    .glass-card {
        padding: 1.25rem;
    }
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #60a5fa, #38bdf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-secondary);
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin-bottom: 2rem;
    overflow: hidden; /* Evita desbordes */
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="date"],
textarea,
select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
    background: rgba(15, 23, 42, 0.8);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--input-bg);
    padding: 0.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.upload-area:hover {
    border-color: var(--accent-color);
    background: rgba(56, 189, 248, 0.05);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.preview-item {
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
}

.remove-img {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    z-index: 10;
}

.remove-img:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-generate {
    width: 100%;
    background: linear-gradient(135deg, #2563eb, #0891b2);
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    filter: brightness(1.1);
}

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Steps customization */
.step-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.step-header {
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

#master_color {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    border: 3px solid var(--border-color);
    padding: 0;
}
#master_color::-webkit-color-swatch {
    border-radius: 8px;
    border: none;
}
.color-input-wrapper b {
    color: var(--text-primary);
    font-size: 1rem;
}


.live-preview-container {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 1rem;
}
.pdf-mockup {
    width: 100%;
    aspect-ratio: 1/1.41;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,0.1);
}
.mock-page {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center;
    color: #1a3a6b;
}
.mock-bg-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 35%;
    background: #dceef8;
    z-index: 1;
}
.mock-bg-bottom {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 40%;
    background: #1a3a6b;
    z-index: 1;
    clip-path: polygon(0 20%, 30% 0, 70% 30%, 100% 10%, 100% 100%, 0 100%);
}
.mock-content {
    position: relative;
    z-index: 5;
    padding: 10px;
    width: 100%;
}

/* Variaciones de Carátula */
.cover-style-1 .mock-bg-top { height: 35%; clip-path: none; }
.cover-style-1 .mock-bg-bottom { height: 40%; clip-path: polygon(0 20%, 30% 0, 70% 30%, 100% 10%, 100% 100%, 0 100%); }

.cover-style-2 .mock-bg-top { height: 100%; clip-path: polygon(0 0, 100% 0, 100% 40%, 0 60%); }
.cover-style-2 .mock-bg-bottom { height: 100%; clip-path: polygon(0 70%, 100% 50%, 100% 100%, 0 100%); opacity: 0.8; }

.cover-style-3 .mock-bg-top { height: 50%; width: 50%; left: 0; top: 0; clip-path: circle(70% at 0% 0%); }
.cover-style-3 .mock-bg-bottom { height: 50%; width: 50%; right: 0; bottom: 0; clip-path: circle(70% at 100% 100%); }

/* Vista Previa de Estampillas */
.stickers-preview {
    background: #fff !important;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start !important;
}
.preview-stamp-grid {
    display: grid;
    gap: 2px;
    width: 100%;
}
.mini-stamp {
    background: #f1f5f9;
    border: 1px dashed #ccc;
    aspect-ratio: 1/1.4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.mini-stamp img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

/* Controles de Vista Previa */
.preview-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    gap: 5px;
}
.btn-prev, .btn-next {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border-color);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
}
.btn-prev:hover, .btn-next:hover {
    background: var(--accent-color);
}
.page-indicator {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.hidden { display: none !important; }

/* Logout */
.logout-btn {
    color: #ef4444;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: 1rem;
    display: block;
    text-align: center;
}

/* Mock Guía Págin 2 */
.guide-preview {
    background: #fff !important;
    padding: 15px;
    justify-content: flex-start !important;
}
.guide-header-mock {
    width: 60%;
    height: 12px;
    background: #1a3a6b;
    color: #fff;
    font-size: 5px;
    font-weight: bold;
    display: flex;
    align-items: center;
    padding-left: 5px;
    margin-bottom: 10px;
    align-self: flex-start;
    clip-path: polygon(0 0, 100% 0, 95% 100%, 0 100%);
}
.guide-date-box {
    background: #dceef8;
    padding: 3px 10px;
    font-size: 6px;
    font-weight: bold;
    border-radius: 2px;
    align-self: flex-start;
    margin-bottom: 5px;
}
.guide-title-mock {
    font-size: 10px;
    font-weight: bold;
    text-align: left;
    width: 100%;
    margin-bottom: 10px;
}
.guide-materials-mock {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    width: 40%;
    padding: 5px;
    font-size: 4px;
    align-self: flex-end;
    text-align: left;
    margin-bottom: 10px;
}
.guide-steps-mock {
    border: 1px solid #1a3a6b;
    padding: 5px;
    width: 100%;
    border-radius: 4px;
}
.guide-steps-mock strong {
    font-size: 6px;
    display: block;
    border-bottom: 1px solid #eee;
    margin-bottom: 3px;
}

