/* CSS per Ripetizioni & Serie - Modern Dark Mode Design */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@400;500;700;800&display=swap');

:root {
    /* Color Palette */
    --bg-primary: #080c14;
    --bg-secondary: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.4);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f8fafc;
    --text-muted: #cbd5e1; /* Increased contrast (Slate 300) for better readability */
    
    /* Neon Accents */
    --accent: #84cc16; /* Neon Lime */
    --accent-hover: #a3e635;
    --accent-glow: rgba(132, 204, 22, 0.15);
    
    --secondary-accent: #06b6d4; /* Electric Blue */
    --secondary-accent-glow: rgba(6, 182, 212, 0.15);
    
    /* Status Colors */
    --difficulty-facile: #10b981;
    --difficulty-medio: #f59e0b;
    --difficulty-difficile: #ef4444;
    
    /* Layout Constants */
    --max-width: 1200px;
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

a:not(.btn):not(.card):hover {
    color: var(--accent);
}

/* Layout Wrapper */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

main {
    flex: 1;
    padding: 40px 0;
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
}

/* Header & Navbar */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    background: rgba(8, 12, 20, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 20px;
    background: linear-gradient(135deg, var(--accent), var(--secondary-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 32px;
    list-style: none;
}

.nav-links a {
    font-weight: 500;
    font-size: 15px;
    color: var(--text-muted);
    position: relative;
    padding: 6px 0;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
}

/* Banner / Hero Section */
.hero {
    padding: 60px 0 80px;
    text-align: center;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

.hero h1 {
    font-size: 48px;
    line-height: 1.1;
    margin-bottom: 16px;
    background: linear-gradient(to right, #ffffff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 32px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px rgba(132, 204, 22, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

/* Grid & Cards System */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
    margin-top: 40px;
}

.card {
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-6px);
    border-color: var(--border-hover);
    box-shadow: 0 12px 24px -10px rgba(0,0,0,0.5);
}

.card-img-container {
    height: 200px;
    overflow: hidden;
    position: relative;
    background-color: #1e293b;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.card:hover .card-img {
    transform: scale(1.05);
}

.card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

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

.card-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
}

.card-title {
    font-size: 20px;
    margin-bottom: 12px;
    line-height: 1.3;
}

.card-desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-facile {
    background: rgba(16, 185, 129, 0.1);
    color: var(--difficulty-facile);
}

.badge-medio {
    background: rgba(245, 158, 11, 0.1);
    color: var(--difficulty-medio);
}

.badge-difficile {
    background: rgba(239, 68, 68, 0.1);
    color: var(--difficulty-difficile);
}

/* Search and Filters Layout */
.filter-bar {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media(min-width: 768px) {
    .filter-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    max-width: 450px;
}

.search-input {
    width: 100%;
    padding: 14px 20px 14px 46px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Ensure placeholder text is clearly visible with good contrast */
.search-input::placeholder {
    color: #64748b;
    opacity: 0.8;
}

/* Specific styling for select dropdowns to be highly readable in Dark Mode on all browsers */
select.search-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 16px center;
    background-repeat: no-repeat;
    background-size: 18px;
    padding-right: 40px !important;
    cursor: pointer;
}

select.search-input option {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    padding: 12px;
}

/* Override browser autofill text and background colors for Dark Mode compatibility */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary) !important;
    -webkit-box-shadow: 0 0 0px 1000px #0f172a inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.chip {
    padding: 10px 18px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.chip:hover,
.chip.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Article Detail Page */
.post-detail {
    max-width: 800px;
    margin: 0 auto;
}

.post-header {
    text-align: center;
    margin-bottom: 40px;
}

.post-meta {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.post-hero-img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: var(--border-radius);
    margin-bottom: 40px;
}

.post-body {
    font-size: 16px;
    line-height: 1.8;
    color: #e2e8f0;
}

.post-body h2,
.post-body h3 {
    margin: 32px 0 16px;
}

.post-body p {
    margin-bottom: 20px;
}

.post-body ul,
.post-body ol {
    margin: 0 0 20px 24px;
}

.post-body li {
    margin-bottom: 8px;
}

/* Exercise Detail Page */
.exercise-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}

@media(min-width: 992px) {
    .exercise-detail {
        grid-template-columns: 1.2fr 0.8fr;
    }
}

.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
    background-color: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.instruction-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.instruction-list li {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: var(--border-radius);
    background: rgba(255,255,255, 0.02);
    border: 1px solid var(--border-color);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #000000;
    font-weight: 700;
    font-size: 14px;
}

.error-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.error-list li {
    padding: 14px 16px;
    border-radius: var(--border-radius);
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    position: relative;
    padding-left: 44px;
}

.error-list li::before {
    content: '!';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--difficulty-difficile);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
}

.exercise-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-box {
    padding: 24px;
    border-radius: var(--border-radius);
}

.sidebar-box h3 {
    margin-bottom: 16px;
    font-size: 18px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.muscle-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.muscle-tag {
    padding: 6px 12px;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: #22d3ee;
    font-size: 13px;
    border-radius: 20px;
    font-weight: 500;
}

.muscle-tag.secondary {
    background: rgba(255,255,255,0.03);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Footer Section */
footer {
    padding: 40px 0;
    margin-top: 80px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.footer-socials {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
}

.footer-socials a:hover {
    color: var(--accent);
}

/* Mobile responsive menu */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        padding: 20px;
        gap: 16px;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-toggle {
        display: block;
    }
}
