/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f0fdf4 0%, #dbeafe 100%);
    min-height: 100vh;
    color: #374151;
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4 {
    color: #15803d;
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #15803d;
    margin-bottom: 1rem;
}

.card-title-medium {
    font-size: 1.125rem;
    font-weight: 600;
    color: #16a34a;
    margin-bottom: 0.75rem;
}

.card-subtitle {
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.card-info {
    font-size: 0.875rem;
    color: #4338ca;
    margin-top: 0.5rem;
}

/* Navigation */
.navigation {
    background: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0.75rem 1rem;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-item {
    background: none;
    border: none;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0.5rem 0;
    font-size: 1rem;
}

.nav-item:hover {
    color: #2563eb;
}

/* Main layout */
.main-content {
    padding: 1rem;
}

.container {
    max-width: 72rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.card-content {
    padding: 1.5rem;
}

.text-center {
    text-align: center;
}

/* Grid layout */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

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

/* Code container */
.code-container {
    background: #111827;
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.code-line {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
    margin-bottom: 0.125rem;
}

.code-line.active {
    background: #eab308;
    color: black;
    font-weight: bold;
}

/* Variables display */
.variables-display {
    background: #f0fdf4;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.variables-display h4 {
    color: #15803d;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.variables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.875rem;
}

/* Loop status */
.loop-status {
    background: #eff6ff;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.loop-status h4 {
    color: #1d4ed8;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.loop-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.loop-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Progress bars */
.progress-bar {
    width: 100%;
    background: #e5e7eb;
    border-radius: 0.5rem;
    height: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 0.5rem;
}

.outer-progress {
    background: #15803d;
}

.inner-progress {
    background: #2563eb;
}

.overall-progress-fill {
    background: #10b981;
}

/* Input section */
.input-section {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    animation: fadeInUp 0.3s ease;
}

.input-section h4 {
    color: #92400e;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.input-prompt {
    color: #92400e;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.input-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.data-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.data-input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* Buttons */
.btn-primary {
    background: #15803d;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
    background: #166534;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Current worker section */
.current-worker-section {
    background: linear-gradient(135deg, #f0fdf4 0%, #dbeafe 100%);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.current-worker-title {
    color: #15803d;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-align: center;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.day-cell {
    padding: 0.5rem;
    border-radius: 0.375rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: bold;
    border: 2px solid;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.day-cell.current {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
    transform: translateY(-3px) scale(1.05);
}

.day-cell.completed {
    background: #dcfce7;
    border-color: #10b981;
    color: #047857;
}

.day-cell.empty {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #9ca3af;
}

.day-name {
    font-size: 0.65rem;
}

.day-hours {
    font-size: 0.75rem;
}

.day-pay {
    font-size: 0.65rem;
}

.current-total {
    text-align: center;
    color: #15803d;
    font-size: 1.125rem;
}

/* Completed workers */
.completed-workers-section {
    margin-bottom: 1rem;
}

.completed-title {
    color: #047857;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.completed-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 16rem;
    overflow-y: auto;
}

.completed-worker {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 0.75rem;
    border-radius: 0.5rem;
    animation: slideInLeft 0.5s ease;
}

.completed-worker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.completed-worker-name {
    color: #047857;
    font-weight: 600;
}

.completed-worker-total {
    color: #059669;
    font-size: 1.125rem;
    font-weight: bold;
}

.completed-worker-days {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.125rem;
}

.completed-day {
    background: #bbf7d0;
    padding: 0.25rem;
    border-radius: 0.25rem;
    text-align: center;
    font-size: 0.65rem;
    color: #047857;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.completed-day-name {
    font-weight: bold;
}

.completed-day-hours {
    font-size: 0.6rem;
}

.completed-day-pay {
    font-size: 0.6rem;
}

/* Overall progress */
.overall-progress {
    background: #f9fafb;
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.overall-progress h4 {
    color: #374151;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.progress-info {
    margin-bottom: 0.5rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.total-expenses {
    font-size: 0.875rem;
    margin-top: 0.75rem;
    color: #374151;
}

/* Controls */
.controls-wrapper {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-message {
    background: white;
    border: 1px solid #d1d5db;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    max-width: 100%;
    margin: 0 auto;
    word-wrap: break-word;
}

.controls-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.completion-message {
    color: #15803d;
    font-weight: 600;
    font-size: 1.125rem;
    animation: fadeIn 0.5s ease;
}

.completion-hint {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: normal;
}

/* Educational content */
.educational-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.info-item {
    line-height: 1.6;
}

.nesting-info {
    background: #f0fdf4;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border-left: 4px solid #15803d;
    margin-top: 0.75rem;
    line-height: 1.6;
}

.tips-info {
    background: #fef3c7;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border-left: 4px solid #f59e0b;
    margin-top: 0.75rem;
    line-height: 1.6;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.pulse {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .card-content {
        padding: 1rem;
    }
    
    .variables-grid {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .days-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.125rem;
    }
    
    .day-cell {
        padding: 0.375rem;
        font-size: 0.65rem;
    }
    
    .controls-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .input-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .completed-worker-days {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .loop-info {
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .days-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .day-cell {
        padding: 0.25rem;
        font-size: 0.6rem;
    }
    
    .completed-worker-days {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Print styles */
@media print {
    .navigation {
        display: none;
    }
    
    .controls-wrapper {
        display: none;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .day-cell.current {
        background: #ffff00;
        color: #000000;
    }
    
    .day-cell.completed {
        background: #00ff00;
        color: #000000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .day-cell {
        transition: none;
    }
    
    .code-line {
        transition: none;
    }
    
    .progress-fill {
        transition: none;
    }
    
    .completed-worker {
        animation: none;
    }
}