/* ===== CSS VARIABLES ===== */
:root {
    /* Colors - Vibrant Gradient Palette */
    --color-primary: hsl(260, 85%, 65%);
    --color-primary-light: hsl(260, 85%, 75%);
    --color-secondary: hsl(320, 75%, 60%);
    --color-accent: hsl(190, 85%, 55%);
    
    /* Background Colors */
    --color-bg-dark: hsl(240, 20%, 8%);
    --color-bg-darker: hsl(240, 20%, 5%);
    --color-surface: hsla(240, 15%, 12%, 0.7);
    --color-surface-light: hsla(240, 15%, 18%, 0.6);
    
    /* Text Colors */
    --color-text-primary: hsl(0, 0%, 98%);
    --color-text-secondary: hsl(0, 0%, 75%);
    --color-text-muted: hsl(0, 0%, 55%);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    --gradient-accent: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
    --gradient-bg: radial-gradient(ellipse at top left, hsla(260, 85%, 35%, 0.3) 0%, transparent 50%),
                    radial-gradient(ellipse at bottom right, hsla(320, 75%, 30%, 0.3) 0%, transparent 50%);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(160, 90, 255, 0.3);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--color-bg-dark);
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ===== BACKGROUND ===== */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-bg);
    z-index: -1;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* ===== LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-md);
}

/* ===== HEADER ===== */
.header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    animation: fadeInDown 0.6s ease;
}

.title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--color-text-secondary);
    font-weight: 400;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    animation: fadeInUp 0.6s ease 0.2s backwards;
}

@media (min-width: 768px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
    }
    
    .calculator-card {
        grid-row: 1 / 3;
    }
    
    .example-card {
        grid-column: 1 / -1;
    }
}

/* ===== CARDS ===== */
.card {
    background: var(--color-surface);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: var(--color-text-primary);
}

.card-title.small {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
}

/* ===== FORM ===== */
.form-section {
    margin-bottom: var(--spacing-xl);
}

.label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.input-group {
    display: flex;
    gap: var(--spacing-md);
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-md);
    background: var(--color-surface-light);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 1.125rem;
    font-weight: 500;
    transition: all var(--transition-base);
    outline: none;
}

.input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(160, 90, 255, 0.2);
    background: var(--color-surface);
}

.input::placeholder {
    color: var(--color-text-muted);
}

.input-suffix {
    position: absolute;
    right: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

/* ===== BREAKS ===== */
.breaks-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.break-item {
    display: flex;
    gap: var(--spacing-sm);
    animation: slideInLeft 0.3s ease;
}

.break-item .input-wrapper {
    flex: 1;
}

.btn-remove {
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 60, 60, 0.2);
    border: 1px solid rgba(255, 60, 60, 0.3);
    border-radius: var(--radius-md);
    color: hsl(0, 85%, 70%);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 500;
    white-space: nowrap;
}

.btn-remove:hover {
    background: rgba(255, 60, 60, 0.3);
    border-color: rgba(255, 60, 60, 0.5);
    transform: scale(1.05);
}

/* ===== BUTTONS ===== */
.btn-add {
    padding: var(--spacing-xs) var(--spacing-md);
    background: transparent;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-sm);
    color: var(--color-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 500;
    font-size: 0.875rem;
}

.btn-add:hover {
    background: var(--color-primary);
    color: white;
    transform: scale(1.05);
}

.btn-calculate {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    margin-top: var(--spacing-md);
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-calculate:active {
    transform: translateY(0);
}

/* ===== RESULTS ===== */
.results-card {
    background: var(--color-surface);
}

.results-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.result-main {
    text-align: center;
    padding: var(--spacing-lg);
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    animation: pulse 2s ease infinite;
}

.result-value {
    font-size: clamp(3rem, 8vw, 4.5rem);
    font-weight: 700;
    color: white;
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.result-label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.calculation-breakdown {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.breakdown-row.highlight {
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: var(--spacing-md);
    font-weight: 600;
}

.breakdown-label {
    color: var(--color-text-secondary);
}

.breakdown-value {
    color: var(--color-text-primary);
    font-weight: 500;
}

/* ===== EXAMPLE CARD ===== */
.example-card {
    background: var(--color-surface-light);
}

.example-content {
    color: var(--color-text-secondary);
    line-height: 1.8;
}

.example-text {
    margin-bottom: var(--spacing-md);
}

.example-calculation {
    background: var(--color-surface);
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-accent);
    margin: var(--spacing-md) 0;
    font-family: 'Courier New', monospace;
    line-height: 1.8;
}

.example-calculation strong {
    color: var(--color-accent);
}

.example-note {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-style: italic;
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-xl);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@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);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
    .container {
        padding: var(--spacing-md);
    }
    
    .card {
        padding: var(--spacing-lg);
    }
    
    .input-group {
        flex-direction: column;
    }
}
