/* ============================================
   Mini-Notiziario Generator - Stylesheet
   ============================================ */

:root {
    --primary: #1a1a2e;
    --primary-light: #16213e;
    --accent: #0f3460;
    --gold: #e2b714;
    --gold-dark: #c9a012;
    --success: #27ae60;
    --error: #e74c3c;
    --warning: #f39c12;
    --bg: #f5f6fa;
    --white: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --border: #dfe6e9;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--primary);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.nav-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-brand {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-icon {
    font-size: 22px;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}

.nav-logout {
    color: rgba(231, 76, 60, 0.8) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    margin-left: 4px;
}

.nav-logout:hover {
    color: #e74c3c !important;
    background: rgba(231, 76, 60, 0.1) !important;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px;
    flex: 1;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 36px;
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 10px;
}

.hero-subtitle {
    font-size: 16px;
    color: var(--text-light);
}

.hero-subtitle strong {
    color: var(--accent);
}

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 14px;
}

.alert p {
    margin: 0;
}

.alert-error {
    background: #ffeaea;
    border: 1px solid #fcc;
    color: var(--error);
}

.alert-success {
    background: #eafff0;
    border: 1px solid #b8f0c8;
    color: var(--success);
}

.alert-warning {
    background: #fff8ea;
    border: 1px solid #fde5a8;
    color: #856404;
}

/* Form Card */
.form-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px;
    border: 1px solid var(--border);
}

.form-section {
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid #f0f0f0;
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 24px;
    padding-bottom: 0;
}

.form-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.optional {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-light);
    text-transform: none;
    letter-spacing: 0;
}

.form-group {
    margin-bottom: 18px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.1);
}

.form-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-light);
}

.form-help a {
    color: var(--accent);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Lines Input */
.lines-input-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lines-input {
    width: 120px !important;
    padding: 12px 16px !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    text-align: center;
    color: var(--accent) !important;
    border: 2px solid var(--border) !important;
    border-radius: 10px !important;
}

.lines-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.15) !important;
}

.lines-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: var(--white);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(15, 52, 96, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    background: #f8f9ff;
}

.btn-accent {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: var(--primary);
}

.btn-accent:hover {
    box-shadow: 0 4px 16px rgba(226, 183, 20, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-success {
    background: var(--success) !important;
    color: var(--white) !important;
    border-color: var(--success) !important;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    border-radius: 10px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Result Page */
.result-header {
    text-align: center;
    margin-bottom: 28px;
}

.result-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 8px;
}

.result-meta {
    font-size: 14px;
    color: var(--text-light);
}

.actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
    padding: 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* Email Section */
.email-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 28px;
}

.email-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.email-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.email-form .btn {
    align-self: flex-start;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.15s;
}

.checkbox-label:hover {
    background: #f8f9ff;
    border-color: var(--accent);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* Preview */
.preview-container {
    position: relative;
    margin-bottom: 40px;
}

.preview-label {
    position: absolute;
    top: -12px;
    left: 24px;
    background: var(--accent);
    color: var(--white);
    padding: 3px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 1;
}

.preview-frame {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

/* Buttons extra */
.btn-sm {
    padding: 7px 16px;
    font-size: 13px;
    border-radius: 6px;
}

.btn-danger {
    background: var(--white);
    color: var(--error);
    border: 1px solid #fcc;
}

.btn-danger:hover {
    background: #ffeaea;
    border-color: var(--error);
}

/* Archive Page */
.archive-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.archive-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.archive-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.archive-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 12px;
}

.archive-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.archive-card-badge {
    background: var(--primary);
    color: var(--gold);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.archive-card-meta {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.meta-sep {
    margin: 0 6px;
    opacity: 0.5;
}

.meta-source {
    font-style: italic;
}

.archive-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 24px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-light);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* Responsive */
@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .form-card {
        padding: 24px;
    }

    .hero h1 {
        font-size: 24px;
    }

    .actions-bar {
        flex-direction: column;
    }

    .actions-bar .btn {
        width: 100%;
    }

    .range-container {
        flex-direction: column;
        align-items: stretch;
    }
}
