/* MMC Learning - Brand Identity CSS */
/* Mario Mureddu Consulting - E-Learning Platform */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* Primary Brand Colors */
    --mmc-gold: #FFC648;
    --mmc-gold-hover: #E6B242;
    --mmc-gold-light: #FFF3D6;
    --mmc-gold-muted: #D4A43A;
    --mmc-red: #ED1C24;
    --mmc-red-hover: #C41920;
    --mmc-red-light: #FDE8E9;
    --mmc-dark: #333333;
    --mmc-dark-deep: #1A1A1A;

    /* Neutrals */
    --mmc-gray-600: #4D4D4D;
    --mmc-gray-400: #666666;
    --mmc-gray-200: #E5E5E5;
    --mmc-gray-100: #F5F5F5;
    --mmc-white: #FFFFFF;

    /* Semantic Colors */
    --mmc-success: #2D7D46;
    --mmc-success-light: #E8F5E9;
    --mmc-info: #4285F4;
    --mmc-info-light: #E3F2FD;
    --mmc-warning: #FFC648;
    --mmc-warning-light: #FFF3D6;
    --mmc-danger: #ED1C24;
    --mmc-danger-light: #FDE8E9;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-full: 50px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-lg: 0 5px 20px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.2);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.6;
    color: var(--mmc-gray-600);
    background-color: var(--mmc-gray-100);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--mmc-gold-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--mmc-gold-hover);
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    color: var(--mmc-dark);
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

p {
    margin-bottom: var(--space-md);
}

small, .text-small {
    font-size: 0.875rem;
    color: var(--mmc-gray-400);
}

/* ============================================
   Layout
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

.container-sm {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

.page-content {
    flex: 1;
    padding: var(--space-2xl) 0;
}

/* ============================================
   Header / Navbar
   ============================================ */
.header {
    background: linear-gradient(135deg, var(--mmc-dark) 0%, var(--mmc-dark-deep) 100%);
    padding: var(--space-md) var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header--landing {
    background: transparent;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
}

.header .logo,
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    text-decoration: none;
}

.header .logo-img,
.logo-img {
    max-height: 40px;
    width: auto;
}

.header .logo-text,
.logo-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 300;
}

.logo-text strong {
    font-weight: 600;
    color: var(--mmc-gold);
}

.header .nav,
.nav {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    list-style: none;
}

.header .nav a,
.nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.header .nav a:hover,
.nav a:hover {
    color: white;
    background: rgba(255,198,72,0.15);
}

.nav a.active {
    color: var(--mmc-gold);
    border-bottom: 2px solid var(--mmc-gold);
}

/* Legacy aliases */
.navbar { /* same as .header */ }
.nav-links { display: flex; gap: var(--space-sm); align-items: center; list-style: none; }
.nav-link { color: rgba(255,255,255,0.85); text-decoration: none; font-weight: 600; font-size: 0.9375rem; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm); transition: all var(--transition-fast); }
.nav-link:hover { color: white; background: rgba(255,198,72,0.15); }
.nav-link.active { color: var(--mmc-gold); border-bottom: 2px solid var(--mmc-gold); }

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

.btn-primary {
    background-color: var(--mmc-gold);
    color: var(--mmc-dark);
}

.btn-primary:hover {
    background-color: var(--mmc-gold-hover);
    color: var(--mmc-dark);
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--mmc-gold);
    color: var(--mmc-gold);
}

.btn-secondary:hover {
    background-color: var(--mmc-gold);
    color: var(--mmc-dark);
}

.btn-danger {
    background-color: var(--mmc-red);
    color: white;
}

.btn-danger:hover {
    background-color: var(--mmc-red-hover);
    color: white;
}

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

.btn-outline-danger:hover {
    background-color: var(--mmc-red);
    color: white;
}

.btn-google {
    background: white;
    border: 2px solid var(--mmc-info);
    color: var(--mmc-dark);
    padding: 0.875rem 2rem;
    border-radius: var(--radius-full);
}

.btn-google:hover {
    background: var(--mmc-info);
    color: white;
}

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

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
}

.btn-gradient {
    background: linear-gradient(135deg, var(--mmc-gold) 0%, var(--mmc-red) 100%);
    color: white;
    border: none;
}

.btn-gradient:hover {
    opacity: 0.9;
    color: white;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--mmc-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-xl);
    border: 1px solid var(--mmc-gray-200);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

.card-header {
    border-bottom: 2px solid var(--mmc-gold-light);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-lg);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--mmc-dark);
    margin-bottom: var(--space-xs);
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--mmc-gray-400);
}

.card-body {
    color: var(--mmc-gray-600);
}

.card-footer {
    border-top: 1px solid var(--mmc-gray-200);
    padding-top: var(--space-md);
    margin-top: var(--space-lg);
}

/* Course cards grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-xl);
}

/* ============================================
   Progress Bar
   ============================================ */
.progress-bar {
    background: var(--mmc-gray-200);
    border-radius: var(--radius-full);
    height: 8px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, var(--mmc-gold) 0%, var(--mmc-gold-hover) 100%);
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

.progress-fill.complete {
    background: var(--mmc-success);
}

.progress-text {
    font-size: 0.8rem;
    color: var(--mmc-gray-400);
    margin-top: var(--space-xs);
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    margin-bottom: var(--space-lg);
    font-size: 0.95rem;
}

.alert-success {
    background: var(--mmc-success-light);
    border-color: var(--mmc-success);
    color: #1B5E20;
}

.alert-warning {
    background: var(--mmc-warning-light);
    border-color: var(--mmc-gold);
    color: #7C6100;
}

.alert-danger {
    background: var(--mmc-danger-light);
    border-color: var(--mmc-red);
    color: #8B0000;
}

.alert-info {
    background: var(--mmc-info-light);
    border-color: var(--mmc-info);
    color: #0D47A1;
}

/* ============================================
   Tables
   ============================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--mmc-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table th {
    background: var(--mmc-dark);
    color: white;
    font-weight: 600;
    text-align: left;
    padding: var(--space-md) var(--space-lg);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--mmc-gray-200);
    font-size: 0.9375rem;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: var(--mmc-gold-light);
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--mmc-dark);
    margin-bottom: var(--space-sm);
    font-size: 0.9375rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--mmc-gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    color: var(--mmc-dark);
    transition: border-color var(--transition-fast);
    background: var(--mmc-white);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--mmc-gold);
    box-shadow: 0 0 0 3px var(--mmc-gold-light);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.form-check input[type="checkbox"] {
    margin-top: 4px;
    accent-color: var(--mmc-gold);
}

.form-help {
    font-size: 0.8rem;
    color: var(--mmc-gray-400);
    margin-top: var(--space-xs);
}

.form-error {
    font-size: 0.8rem;
    color: var(--mmc-red);
    margin-top: var(--space-xs);
}

/* ============================================
   Badges & Tags
   ============================================ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-gold {
    background: var(--mmc-gold-light);
    color: var(--mmc-gold-muted);
}

.badge-success {
    background: var(--mmc-success-light);
    color: var(--mmc-success);
}

.badge-danger {
    background: var(--mmc-danger-light);
    color: var(--mmc-red);
}

.badge-info {
    background: var(--mmc-info-light);
    color: var(--mmc-info);
}

/* ============================================
   Stats Cards
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: var(--mmc-white);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--mmc-gold);
}

.stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--mmc-dark);
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--mmc-gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background-color: var(--mmc-dark);
    color: rgba(255,255,255,0.7);
    padding: var(--space-xl) var(--space-xl);
    text-align: center;
    margin-top: auto;
}

.footer a {
    color: var(--mmc-gold);
    text-decoration: none;
}

.footer a:hover {
    color: var(--mmc-gold-hover);
}

.footer .footer-logo {
    max-height: 30px;
    margin-bottom: var(--space-md);
    opacity: 0.8;
}

/* ============================================
   Landing Page
   ============================================ */
body.landing {
    background: linear-gradient(135deg, var(--mmc-dark) 0%, var(--mmc-dark-deep) 100%);
    color: white;
}

body.landing .footer {
    background: transparent;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.hero-section {
    padding: calc(80px + var(--space-3xl)) var(--space-xl) var(--space-3xl);
}

.text-accent {
    color: var(--mmc-gold);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-xl);
    max-width: 1000px;
    margin: var(--space-2xl) auto 0;
    padding: 0 var(--space-xl);
}

/* ============================================
   Standalone Pages (login, privacy notice)
   ============================================ */
body.standalone {
    background: var(--mmc-gray-100);
    display: flex;
    flex-direction: column;
}

/* ============================================
   Auth Card (login, privacy notice)
   ============================================ */
.auth-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-3xl);
    max-width: 450px;
    width: 90%;
    margin: auto;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.auth-card--wide {
    max-width: 650px;
}

.auth-logo {
    display: block;
    max-height: 80px;
    margin: 0 auto var(--space-2xl);
}

.auth-card h1 {
    font-weight: 300;
    font-size: 1.8rem;
    margin-bottom: var(--space-sm);
}

.auth-card p {
    color: var(--mmc-gray-400);
    margin-bottom: var(--space-2xl);
}

/* Google Sign-In Button */
.google-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    background: white;
    border: 2px solid var(--mmc-gray-200);
    color: var(--mmc-dark);
    padding: 0.875rem 2rem;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-normal);
    width: 100%;
}

.google-btn:hover {
    border-color: var(--mmc-info);
    background: var(--mmc-info-light);
    color: var(--mmc-dark);
}

.google-btn svg {
    flex-shrink: 0;
}

/* Legacy login-page aliases */
.login-page {
    background: linear-gradient(135deg, var(--mmc-gold) 0%, var(--mmc-red) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-3xl);
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.login-card .login-logo {
    width: 120px;
    margin-bottom: var(--space-2xl);
}

.login-card h1 {
    font-weight: 300;
    font-size: 1.8rem;
    margin-bottom: var(--space-sm);
}

.login-card p {
    color: var(--mmc-gray-400);
    margin-bottom: var(--space-2xl);
}

/* ============================================
   Consent Page (standalone)
   ============================================ */
.consent-page {
    background: linear-gradient(135deg, var(--mmc-gold) 0%, var(--mmc-red) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.consent-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-3xl);
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-xl);
}

.consent-item {
    background: var(--mmc-gray-100);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.consent-item h3 {
    font-size: 1rem;
    margin-bottom: var(--space-xs);
}

.consent-item p {
    font-size: 0.9rem;
    color: var(--mmc-gray-400);
    margin-bottom: 0;
}

/* ============================================
   Hero Section (landing page)
   ============================================ */
.hero {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
}

.hero h1 .accent {
    color: var(--mmc-red);
}

.hero p {
    font-size: 1.2rem;
    color: var(--mmc-gray-400);
    line-height: 1.6;
    margin-bottom: var(--space-2xl);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-xl);
    margin-top: var(--space-2xl);
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.feature-card {
    background: white;
    padding: var(--space-xl);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    text-align: left;
}

.feature-card h3 {
    color: var(--mmc-dark);
    margin-bottom: var(--space-sm);
}

.feature-card p {
    color: var(--mmc-gray-400);
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    color: var(--mmc-gray-400);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--mmc-gray-400);
    font-weight: 400;
    margin-bottom: var(--space-sm);
}

/* ============================================
   GDPR Section
   ============================================ */
.gdpr-section {
    background: var(--mmc-white);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.gdpr-section h3 {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--mmc-gold-light);
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-gold { color: var(--mmc-gold); }
.text-red { color: var(--mmc-red); }
.text-success { color: var(--mmc-success); }
.text-muted { color: var(--mmc-gray-400); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: var(--space-sm); }
.gap-2 { gap: var(--space-md); }
.gap-3 { gap: var(--space-lg); }

/* ============================================
   HTMX SPA Transitions
   ============================================ */
main {
    transition: opacity var(--transition-fast);
}

.htmx-swapping > main {
    opacity: 0;
}

/* Loading bar at top of page */
body.htmx-request::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 9999;
    background: linear-gradient(90deg, var(--mmc-gold), var(--mmc-red), var(--mmc-gold));
    background-size: 200% 100%;
    animation: htmx-loading-bar 1.5s ease-in-out infinite;
}

@keyframes htmx-loading-bar {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .header, .navbar {
        flex-direction: column;
        gap: var(--space-md);
        padding: var(--space-md);
    }

    .nav, .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.4rem; }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .auth-card, .login-card, .consent-card {
        padding: var(--space-xl);
    }

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