
/* CSS Custom Properties for consistent theming */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #fc466b 0%, #3f5efb 100%);
    --warning-gradient: linear-gradient(135deg, #fdbb2d 0%, #22c1c3 100%);
    --info-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --dark-gradient: linear-gradient(135deg, #232526 0%, #414345 100%);
    
    --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 15px 35px rgba(0, 0, 0, 0.2);
    
    --border-radius: 12px;
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    padding: 20px 0;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Container Styles */
.dice-simulator-container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header Styles */
.text-gradient {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Card Enhancements */
.card {
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}

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

.card-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.bg-gradient-primary {
    background: var(--primary-gradient) !important;
}

.bg-gradient-success {
    background: var(--success-gradient) !important;
}

.bg-gradient-info {
    background: var(--info-gradient) !important;
}

/* Dice Count Selector */
.dice-count-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.dice-count-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
    border: 2px solid #667eea;
    position: relative;
    overflow: hidden;
}

.dice-count-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left var(--transition-medium);
}

.dice-count-btn:hover::before {
    left: 100%;
}

.dice-count-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    transform: scale(1.1);
    box-shadow: var(--shadow-medium);
}

/* Dice Type Selectors */
.dice-selector-item {
    margin-bottom: 20px;
}

.dice-type-select {
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    background: white;
}

.dice-type-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    outline: none;
}

.dice-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: block;
}

/* Roll Button */
.btn-gradient-success {
    background: var(--success-gradient);
    border: none;
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    padding: 15px 40px;
    border-radius: 50px;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-gradient-success::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left var(--transition-medium);
}

.btn-gradient-success:hover::before {
    left: 100%;
}

.btn-gradient-success:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-heavy);
}

.btn-gradient-success:active {
    transform: translateY(-1px);
}

/* Results Container */
.results-container {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
}

.no-results {
    text-align: center;
    opacity: 0.7;
}

/* Individual Dice Results */
.dice-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    transition: all var(--transition-medium);
    min-width: 120px;
    margin: 10px;
}

.dice-result:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.dice-visual {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
}

.dice-visual::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    opacity: 0.8;
    z-index: 1;
}

.dice-visual span {
    position: relative;
    z-index: 2;
}

/* Dice Type Colors */
.dice-d4 {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
}

.dice-d6 {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
}

.dice-d8 {
    background: linear-gradient(135deg, #45b7d1 0%, #96c93d 100%);
}

.dice-d10 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.dice-d12 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.dice-d20 {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.dice-d100 {
    background: linear-gradient(135deg, #ffa726 0%, #ffcc02 100%);
}

.dice-type-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 5px;
}

.dice-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #495057;
}

/* Total Sum Display */
.total-sum-card {
    background: var(--success-gradient);
    color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.total-sum-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.total-sum-card h3 {
    margin-bottom: 10px;
    font-weight: 600;
    position: relative;
    z-index: 2;
}

.total-value {
    font-size: 3rem;
    font-weight: bold;
    position: relative;
    z-index: 2;
}

/* Statistics Section */
.stat-item {
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    margin: 5px;
    transition: all var(--transition-fast);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #495057;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

/* Animations */
.rolling-animation {
    animation: rollDice 1s ease-in-out;
}

@keyframes rollDice {
    0% { transform: rotateX(0deg) rotateY(0deg); }
    25% { transform: rotateX(90deg) rotateY(180deg); }
    50% { transform: rotateX(180deg) rotateY(360deg); }
    75% { transform: rotateX(270deg) rotateY(540deg); }
    100% { transform: rotateX(360deg) rotateY(720deg); }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

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

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .dice-simulator-container {
        padding: 0 10px;
    }
    
    .dice-count-selector {
        justify-content: center;
    }
    
    .dice-count-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .btn-gradient-success {
        font-size: 1rem;
        padding: 12px 30px;
    }
    
    .dice-visual {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .total-value {
        font-size: 2.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .results-container {
        min-height: 120px;
        gap: 15px;
    }
    
    .dice-result {
        min-width: 100px;
        padding: 15px;
        margin: 5px;
    }
}

@media (max-width: 576px) {
    .display-4 {
        font-size: 2rem;
    }
    
    .dice-count-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    .dice-visual {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .total-value {
        font-size: 2rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .dice-result {
        min-width: 80px;
        padding: 10px;
    }
}

/* Loading and disabled states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Accessibility improvements */
.btn:focus,
.dice-count-btn:focus,
.dice-type-select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .btn {
        display: none !important;
    }
}

