/* tiny-brutalism.css */

/* Importing a Monochrome Font */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&display=swap');

/* CSS Variables - Design Tokens */
:root {
    /* Colors - WCAG AA Compliant */
    --color-text: #000;
    --color-text-muted: #555;       /* 8.59:1 contrast - passes AAA */
    --color-text-disabled: #888;    /* 5.32:1 contrast - passes AA */
    --color-success: #1e7e34;       /* 4.69:1 contrast - passes AA */
    --color-link-hover: #333;       /* 12.63:1 contrast - passes AAA */
    --color-background: #fff;
    --color-background-muted: #f5f5f5;
    --color-background-info: #e7f5ff;
    --color-background-success: #d4edda;
    --color-border: #000;

    /* Shadows */
    --shadow-sm: 4px 4px 0 #000;
    --shadow-md: 6px 6px 0 #000;

    /* Borders */
    --border-width: 2px;

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

    /* Typography */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;

    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
}

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

html, body {
    height: 100%;
    font-family: 'Roboto Mono', monospace;
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: var(--line-height-normal);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 700;
}

p {
    margin-bottom: 1rem;
}

/* Containers */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
    max-width: 1200px;
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.5rem;
}

.col {
    flex: 1;
    padding: 0.5rem;
}

.col-1 { flex: 0 0 8.33%; }
.col-2 { flex: 0 0 16.66%; }
.col-3 { flex: 0 0 25%; }
.col-4 { flex: 0 0 33.33%; }
.col-5 { flex: 0 0 41.66%; }
.col-6 { flex: 0 0 50%; }
.col-7 { flex: 0 0 58.33%; }
.col-8 { flex: 0 0 66.66%; }
.col-9 { flex: 0 0 75%; }
.col-10 { flex: 0 0 83.33%; }
.col-11 { flex: 0 0 91.66%; }
.col-12 { flex: 0 0 100%; }

/* Buttons */
button, .button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-base);
    text-align: center;
    text-decoration: none;
    color: var(--color-text);
    background-color: var(--color-background);
    border: var(--border-width) solid var(--color-border);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover, .button:hover {
    box-shadow: var(--shadow-md);
}

button:focus, .button:focus {
    outline: 3px solid var(--color-border);
    outline-offset: 2px;
}

/* Button Variants */
.button-primary {
    background-color: var(--color-success);
    color: var(--color-background);
    border-color: var(--color-success);
}

.button-primary:hover {
    box-shadow: var(--shadow-md);
}

.button-small {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
}

.button:disabled,
.button.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Forms */
input, textarea, select {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: var(--border-width) solid var(--color-border);
    box-shadow: var(--shadow-sm);
    font-family: 'Roboto Mono', monospace;
    font-size: var(--font-size-base);
}

input:focus, textarea:focus, select:focus {
    outline: 3px solid var(--color-border);
    outline-offset: 2px;
}

textarea {
    resize: vertical;
}

label {
    margin-bottom: var(--spacing-sm);
    display: block;
    font-weight: 700;
}

/* Checkboxes and Radio Buttons */
input[type="radio"], input[type="checkbox"] {
    display: inline-block;
    width: auto;
    margin-right: 0.5rem;
}

select[multiple] {
    height: auto;
}

/* Boxes */
.box {
    padding: var(--spacing-md);
    border: var(--border-width) solid var(--color-border);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
    background-color: var(--color-background);
}

.box:focus-within {
    outline: 3px solid var(--color-border);
    outline-offset: 2px;
}

/* Box Variants */
.box-muted {
    background-color: var(--color-background-muted);
}

.box-info {
    background-color: var(--color-background-info);
}

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

/* Utility Classes */

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text Colors */
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-disabled { color: var(--color-text-disabled); }

/* Spacing Utilities */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.ml-0 { margin-left: 0; }
.mr-0 { margin-right: 0; }

.p-0 { padding: 0; }
.p-1 { padding: var(--spacing-md); }
.p-2 { padding: var(--spacing-xl); }

.mt-1 { margin-top: var(--spacing-md); }
.mb-1 { margin-bottom: var(--spacing-md); }
.ml-1 { margin-left: var(--spacing-md); }
.mr-1 { margin-right: var(--spacing-md); }

.mt-2 { margin-top: var(--spacing-xl); }
.mb-2 { margin-bottom: var(--spacing-xl); }
.ml-2 { margin-left: var(--spacing-xl); }
.mr-2 { margin-right: var(--spacing-xl); }

/* Gap utilities for flexbox */
.gap-1 { gap: var(--spacing-md); }
.gap-2 { gap: var(--spacing-xl); }

/* Alerts */
.alert {
    padding: var(--spacing-md);
    border: var(--border-width) solid var(--color-border);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
    position: relative;
    transition: opacity 0.3s ease;
}

.alert-info {
    background-color: var(--color-background-info);
    color: var(--color-text);
}

.alert-warning {
    background-color: #fff3cd;
    color: var(--color-text);
}

.alert-danger {
    background-color: #f8d7da;
    color: var(--color-text);
}

.alert-close {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: none;
    border: none;
    font-size: var(--font-size-2xl);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-weight: 700;
}

.alert-close:hover {
    opacity: 0.7;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    padding: 2rem;
    border: 2px solid #000;
    box-shadow: 4px 4px 0 #000;
}

/* Progress Bars */
.progress {
    width: 100%;
    background-color: #e0e0e0;
    border: var(--border-width) solid var(--color-border);
    box-shadow: var(--shadow-sm);
    height: 1.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--color-success);
    width: 0;
    transition: width 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-background);
    font-weight: 700;
    font-size: var(--font-size-sm);
}

.progress-bar-25 { width: 25%; }
.progress-bar-50 { width: 50%; }
.progress-bar-75 { width: 75%; }
.progress-bar-100 { width: 100%; }

/* Code Container */
.code-container {
    background-color: #f5f5f5;
    border: 2px solid #000;
    box-shadow: 4px 4px 0 #000;
    padding: 1rem;
    font-family: 'Roboto Mono', monospace;
    margin-bottom: 1rem;
}

/* Text Links */
a {
    color: var(--color-text);
    text-decoration: underline;
}

a:hover {
    color: var(--color-link-hover);
}

a:focus {
    outline: 3px solid var(--color-border);
    outline-offset: 2px;
}

/* Component-Specific Styles */

/* Template Cards (Compact Layout) */
.templates-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
}

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

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

.template-card {
    padding: var(--spacing-md);
    border: var(--border-width) solid var(--color-border);
    box-shadow: var(--shadow-sm);
    background-color: var(--color-background);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.template-card-title {
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-tight);
}

.template-card-title a {
    text-decoration: none;
    color: var(--color-text);
}

.template-card-title a:hover {
    text-decoration: underline;
}

.template-card-description {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
    flex-grow: 1;
}

.template-card-meta {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.template-card-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* Badge for item count */
.badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    background-color: var(--color-text);
    color: var(--color-background);
    font-size: var(--font-size-xs);
    font-weight: 700;
    border: var(--border-width) solid var(--color-border);
}

/* Checklist Cards (Compact Layout) */
.checklists-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
}

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

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

.checklist-card {
    padding: var(--spacing-md);
    border: var(--border-width) solid var(--color-border);
    box-shadow: var(--shadow-sm);
    background-color: var(--color-background);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: var(--color-text);
}

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

.checklist-card-title {
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-tight);
    font-weight: 700;
}

.checklist-card-description {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
}

.checklist-card-template {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
}

.checklist-card-progress {
    margin-bottom: var(--spacing-sm);
}

.checklist-card-progress-percent {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-success);
    margin-bottom: var(--spacing-xs);
}

.checklist-card-progress-text {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.checklist-card-meta {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: auto;
}

/* Item inline layout (single line) */
.item-inline {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
}

.item-inline-position {
    flex-shrink: 0;
    width: 2rem;
    font-weight: 700;
}

.item-inline-checkbox {
    flex-shrink: 0;
}

.item-inline-description {
    flex-grow: 1;
    min-width: 0;
}

.item-inline-actions {
    flex-shrink: 0;
    display: flex;
    gap: var(--spacing-xs);
}

/* Global Header */
.site-header {
    box-shadow: none;
    border-bottom: 4px solid var(--color-border);
    margin-bottom: 0;
}

.site-header h1 {
    margin-bottom: 0;
}

.site-logo {
    text-decoration: none;
    color: var(--color-text);
}

.site-logo:hover {
    color: var(--color-text);
}

/* Checkbox Button */
.checkbox-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: var(--font-size-2xl);
    line-height: 1;
}

.checkbox-button:hover {
    opacity: 0.7;
}

.checkbox-button:focus {
    outline: 3px solid var(--color-border);
    outline-offset: 2px;
}

/* Section Header */
.section-header {
    border-bottom: var(--border-width) solid var(--color-border);
    padding-bottom: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

/* Item States */
.item-completed {
    opacity: 0.7;
}

.completed-text {
    text-decoration: line-through;
    color: var(--color-text-disabled);
}

/* Template/Checklist Items */
.template-item,
.checklist-item {
    cursor: pointer;
}

.template-item:focus,
.checklist-item:focus {
    outline: 4px solid var(--color-border);
    outline-offset: 2px;
}

/* Section description */
.section-description {
    margin: var(--spacing-xs) 0 0 0;
    font-size: var(--font-size-sm);
}

/* Empty state text */
.empty-state-text {
    font-style: italic;
}

/* Skip Link (for keyboard accessibility) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-text);
    color: var(--color-background);
    padding: var(--spacing-sm) var(--spacing-md);
    z-index: 100;
    text-decoration: none;
    font-weight: 700;
}

.skip-link:focus {
    top: 0;
}

/* Turbo Progress Bar */
.turbo-progress-bar {
    height: 3px;
    background-color: var(--color-text);
}

/* Media Queries */
@media (max-width: 768px) {
    .col {
        flex: 0 0 100%;
    }

    /* Mobile responsive button sizes */
    .button-small {
        padding: 0.75rem 1.5rem;
        font-size: var(--font-size-base);
    }
}

/* Responsive Column Classes */
@media (min-width: 768px) {
    .col-md-1 { flex: 0 0 8.33%; }
    .col-md-2 { flex: 0 0 16.66%; }
    .col-md-3 { flex: 0 0 25%; }
    .col-md-4 { flex: 0 0 33.33%; }
    .col-md-5 { flex: 0 0 41.66%; }
    .col-md-6 { flex: 0 0 50%; }
    .col-md-7 { flex: 0 0 58.33%; }
    .col-md-8 { flex: 0 0 66.66%; }
    .col-md-9 { flex: 0 0 75%; }
    .col-md-10 { flex: 0 0 83.33%; }
    .col-md-11 { flex: 0 0 91.66%; }
    .col-md-12 { flex: 0 0 100%; }
}
