/* ===================================================================
   FIREARMS COLLECTION - MODERN DESIGN SYSTEM
   Three density modes: comfortable, compact, super-compact
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Open+Sans:wght@400;600&family=JetBrains+Mono&display=swap');

/* === BASE DESIGN TOKENS === */
:root {
    /* Colors */
    --primary: #2C3E50;
    --accent: #E67E22;
    --background: #F8F9FA;
    --surface: #FFFFFF;
    --text-primary: #2C3E50;
    --text-secondary: #6C757D;
    --border: #DEE2E6;
    --success: #27AE60;
    --danger: #E74C3C;
    --warning: #F39C12;
    --info: #3498DB;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);

    /* Typography */
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Open Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* COMFORTABLE (default) */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --font-size-base: 16px;
    --font-size-sm: 0.875rem;
    --font-size-xs: 0.75rem;
    --h1-size: 2rem;
    --h2-size: 1.5rem;
    --h3-size: 1.25rem;
    --card-image-height: 220px;
    --stat-value-size: 2rem;
    --input-padding: 0.75rem 1rem;
    --btn-padding: 0.75rem 1.5rem;
}

/* === DENSITY: COMPACT === */
body.density-compact {
    --space-xs: 0.375rem;
    --space-sm: 0.625rem;
    --space-md: 1rem;
    --space-lg: 1.25rem;
    --space-xl: 2rem;
    --font-size-base: 14px;
    --font-size-sm: 0.8125rem;
    --font-size-xs: 0.6875rem;
    --h1-size: 1.5rem;
    --h2-size: 1.125rem;
    --h3-size: 0.9375rem;
    --card-image-height: 160px;
    --stat-value-size: 1.5rem;
    --input-padding: 0.5rem 0.625rem;
    --btn-padding: 0.5rem 1rem;
    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 8px rgba(0,0,0,0.12);
}

/* === DENSITY: SUPER COMPACT === */
body.density-super-compact {
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --font-size-base: 13px;
    --font-size-sm: 0.75rem;
    --font-size-xs: 0.6875rem;
    --h1-size: 1.25rem;
    --h2-size: 1rem;
    --h3-size: 0.8125rem;
    --card-image-height: 120px;
    --stat-value-size: 1.125rem;
    --input-padding: 0.375rem 0.5rem;
    --btn-padding: 0.375rem 0.75rem;
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 3px rgba(0,0,0,0.06);
    --shadow-lg: 0 3px 6px rgba(0,0,0,0.08);
}

/* Auto super-compact on tablets */
@media (max-width: 1024px) and (min-width: 768px) {
    body:not(.density-comfortable):not(.density-compact) {
        --space-xs: 0.25rem;
        --space-sm: 0.5rem;
        --space-md: 0.75rem;
        --space-lg: 1rem;
        --font-size-base: 13px;
        --card-image-height: 120px;
    }
}

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

/* === BASE STYLES === */
body {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary);
}

h1 { font-size: var(--h1-size); }
h2 { font-size: var(--h2-size); }
h3 { font-size: var(--h3-size); }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #D35400;
}

/* === LAYOUT === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-md);
}

.page-header {
    background: var(--surface);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
}

.page-title {
    font-size: var(--h1-size);
    margin-bottom: var(--space-xs);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* === STATS CARDS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.stat-card {
    background: var(--surface);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--accent);
    transition: all 0.2s;
}

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

.stat-label {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
    font-weight: 600;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: var(--stat-value-size);
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

/* === FIREARM CARDS === */
.firearms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-sm);
}

body.density-compact .firearms-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

body.density-super-compact .firearms-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.firearm-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    cursor: pointer;
}

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

.firearm-image {
    width: 100%;
    height: var(--card-image-height);
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.firearm-content {
    padding: var(--space-sm);
}

.firearm-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.firearm-specs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.spec-badge {
    padding: 0.25rem 0.5rem;
    background: var(--background);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.spec-badge.primary {
    background: var(--accent);
    color: white;
    font-weight: 600;
}

/* === BUTTONS === */
.btn {
    padding: var(--btn-padding);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: #D35400;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

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

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

.btn-sm {
    padding: calc(var(--btn-padding) * 0.7);
    font-size: var(--font-size-xs);
}

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

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-sm);
}

.form-label .required {
    color: var(--danger);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: var(--input-padding);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
}

/* === TABLES === */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th {
    background: var(--primary);
    color: white;
    padding: var(--space-sm);
    text-align: left;
    font-weight: 600;
    font-size: var(--font-size-sm);
}

td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border);
    font-size: var(--font-size-sm);
}

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

tr:hover {
    background: var(--background);
}

/* === ALERTS === */
.alert {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border-left: 4px solid;
}

.alert.error, .error {
    background: #FEE2E2;
    border-color: var(--danger);
    color: #991B1B;
}

.alert.success, .success {
    background: #D1FAE5;
    border-color: var(--success);
    color: #065F46;
}

.alert.info {
    background: #DBEAFE;
    border-color: var(--info);
    color: #1E40AF;
}

.alert.warning {
    background: #FEF3C7;
    border-color: var(--warning);
    color: #92400E;
}

/* === NAVBAR === */
nav {
    background: var(--primary);
    color: white;
    padding: var(--space-sm) var(--space-md);
    box-shadow: var(--shadow-md);
}

nav a {
    color: white;
    margin-right: var(--space-md);
    font-weight: 600;
    font-size: var(--font-size-sm);
}

nav a:hover {
    color: var(--accent);
}

/* === DENSITY SWITCHER === */
.density-switcher {
    display: flex;
    gap: var(--space-xs);
    background: var(--surface);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.density-btn {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-xs);
    font-weight: 600;
    transition: all 0.2s;
}

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

.density-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* === TABS === */
.tabs-container {
    margin-bottom: var(--space-md);
}

.tabs-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--space-md);
    overflow-x: auto;
}

.tab-button {
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
}

.tab-button:hover {
    color: var(--primary);
    background: rgba(230, 126, 34, 0.05);
}

.tab-button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(230, 126, 34, 0.1);
}

.tab-button.active::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #D35400);
    box-shadow: 0 0 8px rgba(230, 126, 34, 0.4);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === UTILITY CLASSES === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

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

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

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .container {
        padding: var(--space-sm);
    }

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

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