/* Repair Checklist Mini App - Styles */

:root {
    --primary: #2c3e50;
    --primary-light: #34495e;
    --accent: #3498db;
    --accent-hover: #2980b9;
    --success: #27ae60;
    --success-hover: #229954;
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --warning: #f39c12;
    --bg: #f5f6fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #e1e8ed;
    --shadow: 0 2px 8px rgba(44, 62, 80, 0.08);
    --shadow-hover: 0 4px 16px rgba(44, 62, 80, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    background: var(--card-bg);
    box-shadow: 0 0 40px rgba(0,0,0,0.05);
}

/* Header */
.header {
    padding: 20px 16px 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.header-info {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    position: relative;
    z-index: 1;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.deadline {
    background: rgba(231, 76, 60, 0.2);
    color: #fadbd8;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.badge.progress {
    background: rgba(52, 152, 219, 0.2);
    color: #d6eaf8;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow);
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
    position: relative;
}

.tab::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
    transform: translateX(-50%);
    transition: var(--transition);
}

.tab:hover {
    color: var(--text);
    background: var(--bg);
}

.tab.active {
    color: var(--accent);
    font-weight: 600;
}

.tab.active::before {
    width: 80%;
}

.tab-icon {
    font-size: 1.2rem;
}

.tab-label {
    font-size: 0.7rem;
    font-weight: 500;
}

.tab-count {
    background: var(--accent);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.tab.active .tab-count {
    background: var(--accent);
}

/* Main */
.main {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.2s ease;
}

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

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

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Search */
.search-box {
    margin-bottom: 12px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--bg);
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

/* Item List */
.item-list {
    list-style: none;
}

.item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: var(--transition);
    cursor: pointer;
}

.item:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.item:active {
    transform: scale(0.98);
}

.item.done {
    opacity: 0.7;
    background: #f8f9fa;
}

.item.done .item-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.item-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    cursor: pointer;
}

.item.done .item-checkbox {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.item-checkbox::after {
    content: '✓';
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0.5);
    transition: var(--transition);
}

.item.done .item-checkbox::after {
    opacity: 1;
    transform: scale(1);
}

.item-text {
    flex: 1;
    font-size: 0.9rem;
    word-break: break-word;
    line-height: 1.4;
}

.item-type-badge {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.item-type-badge.purchase {
    background: #e8f4fd;
    color: var(--accent);
}

.item-type-badge.task {
    background: #e8f8f0;
    color: var(--success);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-state.hidden {
    display: none;
}

/* Progress Summary */
.progress-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #eef2f7 100%);
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.progress-ring {
    position: relative;
    flex-shrink: 0;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}

.progress-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 226;
    stroke-dashoffset: 226;
    transition: stroke-dashoffset 0.5s ease;
}

#progress-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.progress-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat span:first-child {
    font-weight: 700;
    color: var(--text);
}

.subsection-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 20px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Weekends Progress in Progress Tab */
.weekend-progress-item {
    margin-bottom: 12px;
}

.weekend-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 0 4px;
}

.weekend-progress-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.weekend-progress-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.weekend-progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.weekend-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}

/* Weekend Selector */
.weekend-selector {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 4px 12px;
    margin: -4px -16px 16px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.weekend-btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 10px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.weekend-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

/* Footer */
.footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.footer-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.8rem;
}

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

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

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

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

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

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(44, 62, 80, 0.5);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease;
}

.modal-small {
    max-width: 320px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

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

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    line-height: 1;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.form-actions .btn {
    flex: 1;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Touch-friendly */
@media (hover: none) {
    .item:hover {
        box-shadow: none;
        border-color: var(--border);
    }
    .tab:hover {
        background: transparent;
    }
    .weekend-btn:hover {
        background: var(--bg);
        border-color: var(--border);
    }
    .btn:hover {
        background: var(--accent);
    }
    .btn-secondary:hover {
        background: var(--bg);
    }
    .btn-danger:hover {
        background: var(--danger);
    }
}

/* Landscape phone adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 12px 16px 8px;
    }
    .header h1 {
        font-size: 1.2rem;
    }
    .main {
        padding: 12px;
    }
    .footer {
        padding: 12px;
    }
    .progress-summary {
        padding: 16px;
    }
}