:root {
    --primary: #1B2A4A;
    --accent: #C8962E;
    --bg-color: #FAF8F5;
    --text-main: #2D3748;
    --text-muted: #718096;
    --success: #2F7D5B;
    --white: #FFFFFF;
    --border-color: #E8E4DE;
    --danger: #E53E3E;
    
    --status-proposed: #A0AEC0;
    --status-seconded: #D69E2E;
    --status-endorsed: #2F7D5B;

    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.05);
    --shadow-hover: 0 10px 15px rgba(0,0,0,0.05), 0 4px 6px rgba(0,0,0,0.05);
    
    --transition: all 0.25s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    /* Subtle paper texture */
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23e8e4de' fill-opacity='0.2' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
}

/* Typography Fluidity */
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.2; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    min-height: 44px; /* Mobile touch target */
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #121c33;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--accent);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #b08123;
}

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

.btn-outline:hover {
    border-color: var(--text-muted);
    background-color: rgba(0,0,0,0.02);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: auto;
}

.btn-block {
    width: 100%;
}

.icon { margin-right: 0.5rem; }

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}

input[type="text"],
select,
textarea {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    background-color: var(--white);
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200, 150, 46, 0.2);
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: block;
}

/* Views */
.view-container {
    display: none;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.view-container.active {
    display: block;
}

/* Registration */
.registration-card {
    background: var(--white);
    max-width: 450px;
    margin: 4rem auto;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    text-align: center;
    border-top: 4px solid var(--accent);
}

.registration-card h2 { margin-bottom: 1rem; color: var(--accent); }
.registration-card p { margin-bottom: 2rem; color: var(--text-muted); }
.registration-card form { text-align: left; }

/* Header */
.app-header {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    border-top: 4px solid var(--primary);
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.subtitle {
    color: var(--accent);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.user-details {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.user-name { font-weight: 600; }

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--border-color);
    color: var(--text-main);
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Actions & Filters */
.content-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.actions-bar {
    display: flex;
    gap: 1rem;
    flex-direction: column;
}

.filters-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--white);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.status-btn {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.status-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Collapsible Form */
.collapsible-section {
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.4s ease;
    max-height: 1000px;
    opacity: 1;
}

.collapsible-section.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
}

.form-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.form-card h3 { margin-bottom: 1.5rem; }
.form-actions { display: flex; gap: 1rem; justify-content: flex-end; }

/* Grid & Cards */
.items-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.item-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.item-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.item-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.status-badge {
    color: var(--white);
}

.status-proposed { background-color: var(--status-proposed); }
.status-seconded { background-color: var(--status-seconded); }
.status-endorsed { background-color: var(--status-endorsed); }

.category-tag {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
}

.item-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.item-desc {
    color: var(--text-main);
    white-space: pre-wrap;
    margin-bottom: 1rem;
}

.item-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.proposer-info {
    display: flex;
    flex-direction: column;
}

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

.vote-info {
    position: relative;
    cursor: help;
}

.voters-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--primary);
    color: var(--white);
    padding: 0.5rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-md);
}

.vote-info:hover .voters-tooltip {
    display: block;
}

.btn-vote {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-vote:hover:not(:disabled) {
    background: rgba(200, 150, 46, 0.1);
}

.btn-vote.voted {
    background: var(--accent);
    color: var(--white);
}

.btn-vote:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-delete {
    color: var(--danger);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-delete:hover {
    text-decoration: underline;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(27, 42, 74, 0.8);
    z-index: 100;
    padding: 1rem;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    width: 100%;
    max-width: 800px;
    border-radius: var(--radius);
    margin: 2rem auto;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.printable-area {
    padding: 2rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
}

.hidden { display: none !important; }

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--primary);
    color: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Refresh indicator */
.refresh-indicator {
    text-align: right;
    color: var(--text-muted);
}
.dot {
    display: inline-block;
    width: 8px; height: 8px;
    background: var(--success);
    border-radius: 50%;
    margin-left: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(47, 125, 91, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(47, 125, 91, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(47, 125, 91, 0); }
}

/* Media Queries */
@media (min-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .user-info {
        border-top: none;
        padding-top: 0;
    }
    .stats-bar {
        grid-template-columns: repeat(4, 1fr);
    }
    .actions-bar {
        flex-direction: row;
        justify-content: space-between;
    }
    .filters-section {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .filter-group {
        flex-direction: row;
    }
}

@media (min-width: 1024px) {
    .items-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Print Styles */
@media print {
    body * { visibility: hidden; }
    #export-modal, #export-modal * { visibility: visible; }
    #export-modal {
        position: absolute;
        left: 0; top: 0;
        background: transparent;
        padding: 0;
    }
    .modal-content {
        box-shadow: none;
        margin: 0;
        max-width: 100%;
    }
    .modal-header .modal-actions { display: none; }
    
    .print-agenda-header {
        text-align: center;
        margin-bottom: 2rem;
        border-bottom: 2px solid #000;
        padding-bottom: 1rem;
    }
    .print-category {
        margin-top: 1.5rem;
        margin-bottom: 1rem;
        border-bottom: 1px solid #ccc;
    }
    .print-item {
        margin-bottom: 1rem;
        page-break-inside: avoid;
    }
}
