/* ============================================================
   GESTIONE SOCI - MATTI PER LA CUCINA
   Main Stylesheet
   ============================================================ */

/* Footer styles are at the bottom of this file */

:root {
    --primary: #c0392b;
    --primary-dark: #96281b;
    --primary-light: #e74c3c;
    --secondary: #2c3e50;
    --secondary-light: #34495e;
    --accent: #e67e22;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    --bg: #f8f5f2;
    --bg-card: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --text-muted: #95a5a6;
    --border: #ddd;
    --border-light: #eee;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* ============================================================
   LAYOUT PUBLIC
   ============================================================ */
.public-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}

.public-header {
    text-align: center;
    margin-bottom: 2rem;
}

.public-header .logo-text {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.public-header .subtitle {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 520px;
}

.card-lg {
    max-width: 780px;
}

.card-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.card-desc {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ============================================================
   STEPPER
   ============================================================ */
.stepper {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 520px;
}

.stepper .step {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.5rem 0.8rem;
    border-radius: 20px;
    background: #eee;
    white-space: nowrap;
}

.stepper .step.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.stepper .step.done {
    background: var(--success);
    color: #fff;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    font-size: 0.72rem;
    font-weight: 700;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 1.25rem;
}

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

.form-row-3 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 0.35rem;
}

label .required {
    color: var(--danger);
    margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: var(--transition);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

input.error,
select.error {
    border-color: var(--danger);
}

.form-help {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

/* OTP Input */
.otp-wrapper {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.otp-input {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.otp-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

/* Phone input */
.phone-input-group {
    display: flex;
    gap: 0;
}

.phone-prefix {
    padding: 0.7rem 0.8rem;
    border: 2px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: #f5f5f5;
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.phone-input-group input {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Channel selector */
.channel-selector {
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0;
}

.channel-btn {
    flex: 1;
    padding: 0.9rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    font-family: inherit;
}

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

.channel-btn.active {
    border-color: var(--primary);
    background: rgba(192, 57, 43, 0.04);
}

.channel-btn .icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 0.3rem;
}

.channel-btn .label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--secondary-light);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
}

.btn-lg {
    padding: 0.9rem 2rem;
    font-size: 1.05rem;
}

/* Loading spinner */
.btn .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn.loading .spinner {
    display: block;
}

.btn.loading .btn-text {
    opacity: 0.5;
}

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

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

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

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================================
   PRIVACY / CONTRACT DOCUMENT VIEW
   ============================================================ */
.document-view {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    line-height: 1.7;
}

.document-view h4 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.consent-group {
    padding: 1rem;
    background: #fffbf0;
    border: 1px solid #ffc107;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.consent-group label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: 400;
}

.consent-group input[type="radio"],
.consent-group input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
}

/* ============================================================
   TIMER / RESEND
   ============================================================ */
.timer-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 1rem;
}

.resend-link {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
}

.resend-link:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    text-decoration: none;
}

/* ============================================================
   SUCCESS PAGE
   ============================================================ */
.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: #fff;
}

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background: var(--secondary);
    color: #fff;
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.admin-sidebar .brand {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1rem;
}

.admin-sidebar .brand h3 {
    font-size: 1rem;
    font-weight: 700;
}

.admin-sidebar .brand small {
    font-size: 0.75rem;
    opacity: 0.6;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.admin-nav a:hover,
.admin-nav a.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.admin-nav a .badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
}

.admin-main {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
    background: var(--bg);
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-topbar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
}

/* ============================================================
   ADMIN STATS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary);
    margin-top: 0.25rem;
}

.stat-card .stat-detail {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.info { border-left: 4px solid var(--info); }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.table-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.table-filter {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.table-filter input,
.table-filter select {
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    width: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #fafafa;
    border-bottom: 2px solid var(--border-light);
}

tbody td {
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tbody tr:hover {
    background: #f8f9fa;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-suspended { background: #e2e3e5; color: #383d41; }
.badge-paid { background: #d4edda; color: #155724; }
.badge-unpaid { background: #f8d7da; color: #721c24; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--radius);
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ============================================================
   MEMBER DETAIL
   ============================================================ */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.detail-section {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.detail-section h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-light);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-muted);
    font-weight: 500;
}

.detail-value {
    font-weight: 600;
    text-align: right;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    padding: 1.25rem;
}

.pagination a,
.pagination span {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
}

.pagination a:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .stepper {
        flex-wrap: wrap;
    }

    .stepper .step {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
    }

    .card {
        padding: 1.5rem;
    }

    .admin-sidebar {
        display: none;
    }

    .admin-main {
        margin-left: 0;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .otp-input {
        width: 44px;
        height: 52px;
        font-size: 1.2rem;
    }
}

/* ============================================================
   FOOTER - PUBLIC
   ============================================================ */
.public-footer {
    width: 100%;
    max-width: 520px;
    margin: 3rem auto 0 auto;
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border-light);
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.7;
    align-self: center;
}
.public-footer .footer-name {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.82rem;
}
.public-footer .footer-links {
    margin-top: 0.5rem;
}
.public-footer .footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin: 0 0.5rem;
    transition: color var(--transition);
}
.public-footer .footer-links a:hover {
    color: var(--primary);
}

/* ============================================================
   FOOTER - ADMIN
   ============================================================ */
.admin-footer {
    padding: 1.25rem 1.5rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.admin-footer a {
    color: var(--text-muted);
    text-decoration: none;
}
.admin-footer a:hover {
    color: var(--primary);
}
@media (max-width: 600px) {
    .admin-footer {
        flex-direction: column;
        text-align: center;
    }
}
