/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #f59e0b;
    --danger-color: #dc2626;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-color) 0%, #1e293b 100%);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.combinations {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 600;
}

/* Disclaimer Banner */
.disclaimer-banner {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(245, 158, 11, 0.15));
    border: 3px solid var(--danger-color);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.3);
    animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(220, 38, 38, 0.3);
    }
    50% {
        box-shadow: 0 6px 30px rgba(220, 38, 38, 0.5);
    }
}

.disclaimer-icon {
    font-size: 3rem;
    flex-shrink: 0;
    animation: shake 2s ease-in-out infinite;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-5deg); }
    20%, 40%, 60%, 80% { transform: rotate(5deg); }
}

.disclaimer-content {
    flex: 1;
}

.disclaimer-content strong {
    display: block;
    font-size: 1.3rem;
    color: var(--danger-color);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.disclaimer-content p {
    color: var(--text-color);
    line-height: 1.6;
    font-size: 1rem;
}

/* Vehicle Form Section */
.vehicle-form-section {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.vehicle-form-section h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.vehicle-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.required-star {
    color: var(--danger-color);
    font-size: 1rem;
    font-weight: 700;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input:invalid:not(:placeholder-shown),
.form-group select:invalid {
    border-color: var(--danger-color);
}

.form-group input:valid:not(:placeholder-shown),
.form-group select:valid {
    border-color: var(--success-color);
}

.vehicle-display {
    background: var(--bg-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 0.5rem;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.vehicle-info {
    color: var(--text-muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vehicle-info .info-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.vehicle-info.incomplete {
    border-left-color: var(--warning-color);
}

.vehicle-info.incomplete .info-icon {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.vehicle-info.has-data {
    color: var(--text-color);
    font-size: 1.05rem;
    border-left-color: var(--success-color);
}

.vehicle-info strong {
    color: var(--primary-color);
}

/* Dice Section */
.dice-section {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.dice-section-title {
    text-align: center;
    color: var(--text-color);
    font-size: 2rem;
    margin-bottom: 2rem;
}

.dice-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.die-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 0; /* Allow flex items to shrink below content size */
}

.die-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-color);
    padding: 0.4rem 0.6rem;
    border-radius: 0.4rem;
    background: var(--bg-color);
    border: 2px solid;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    min-height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.die-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.die-face {
    font-size: 4rem;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 1rem;
    border: 3px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.die-face:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.die-face.rolling {
    animation: diceRoll 0.3s ease-in-out infinite;
    border-color: var(--secondary-color);
}

@keyframes diceRoll {
    0%, 100% { 
        transform: rotate(0deg) scale(1); 
    }
    25% { 
        transform: rotate(5deg) scale(1.1); 
    }
    50% { 
        transform: rotate(-5deg) scale(1); 
    }
    75% { 
        transform: rotate(5deg) scale(1.1); 
    }
}

/* Roll Button */
.roll-button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 1.25rem 3rem;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    display: block;
    margin: 0 auto;
}

.roll-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

.roll-button:active:not(:disabled) {
    transform: translateY(0);
}

.roll-button:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    box-shadow: none;
}

/* Results Section */
.results-section {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    margin-bottom: 2rem;
}

.results-section.show {
    opacity: 1;
    transform: translateY(0);
}

.results-title {
    text-align: center;
    color: var(--text-color);
    font-size: 2rem;
    margin-bottom: 2rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.result-card {
    background: var(--bg-color);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.result-header {
    padding: 1.25rem;
    background: rgba(30, 41, 59, 0.5);
    border-left: 4px solid;
}

.result-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.result-category {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.severity-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.severity-badge.high {
    background: rgba(220, 38, 38, 0.2);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.severity-badge.medium {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
}

.severity-badge.low {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.result-issue-name {
    font-size: 1.3rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-body {
    padding: 1.25rem;
}

.result-description {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.result-subtitle {
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.symptoms-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.symptoms-list li {
    padding: 0.5rem;
    background: var(--card-bg);
    border-radius: 0.4rem;
    border-left: 2px solid var(--primary-color);
    font-size: 0.9rem;
}

.symptoms-list li::before {
    content: "⚠️ ";
    margin-right: 0.5rem;
}

.result-cost {
    padding: 0.75rem;
    background: var(--card-bg);
    border-radius: 0.4rem;
    color: var(--secondary-color);
    font-size: 1rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0;
    color: var(--text-muted);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.footer-disclaimer {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--warning-color);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dice-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 1rem;
        max-width: 750px;
    }
    
    .die-face {
        font-size: 3rem;
        width: 90px;
        height: 90px;
    }
    
    .die-label {
        font-size: 0.65rem;
        padding: 0.3rem 0.4rem;
    }
    
    .die-icon {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .disclaimer-banner {
        flex-direction: column;
        gap: 1rem;
        padding: 1.25rem;
        text-align: center;
    }

    .disclaimer-icon {
        font-size: 2.5rem;
    }

    .disclaimer-content strong {
        font-size: 1.1rem;
    }

    .disclaimer-content p {
        font-size: 0.9rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .dice-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.75rem;
        max-width: 100%;
    }

    .die-face {
        font-size: 2.5rem;
        width: 70px;
        height: 70px;
    }

    .die-label {
        font-size: 0.55rem;
        padding: 0.25rem 0.3rem;
        white-space: normal;
        word-wrap: break-word;
        hyphens: auto;
        line-height: 1.1;
    }

    .roll-button {
        padding: 1rem 2rem;
        font-size: 1.2rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .result-issue-name {
        font-size: 1.1rem;
    }

    .dice-section-title,
    .results-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .dice-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.5rem;
    }

    .die-face {
        font-size: 2rem;
        width: 60px;
        height: 60px;
    }

    .die-label {
        font-size: 0.5rem;
        padding: 0.2rem 0.25rem;
        min-height: 2rem;
    }

    .die-icon {
        font-size: 1rem;
    }
}

/* Loading State */
.loading {
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid var(--text-muted);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
