/* ========================================
   D&D Roller Pro - Styles
   Red & Black Dark Fantasy Theme
   ======================================== */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a0000 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === MAIN CONTAINER === */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* === HEADER === */
.header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #1a0000 0%, #330000 100%);
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 8px 20px rgba(255, 0, 0, 0.3);
    border: 2px solid #660000;
}

.title {
    font-size: 3rem;
    font-weight: bold;
    color: #ff0000;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8),
                 0 0 40px rgba(255, 0, 0, 0.5);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.2rem;
    color: #cccccc;
    font-style: italic;
}

/* === MAIN CONTENT GRID === */
.main-content {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 20px;
    align-items: start;
}

/* === CONTROLS PANEL === */
.controls-panel {
    background: #1a1a1a;
    border-radius: 15px;
    padding: 20px;
    border: 2px solid #660000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.control-section {
    margin-bottom: 25px;
}

.control-section h3 {
    color: #ff0000;
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Modifier Controls */
.modifier-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.btn-modifier {
    background: #660000;
    color: #ffffff;
    border: 2px solid #ff0000;
    border-radius: 8px;
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn-modifier:hover {
    background: #ff0000;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.6);
}

.btn-modifier:active {
    transform: scale(0.95);
}

#modifierValue {
    background: #0a0a0a;
    color: #ff0000;
    border: 2px solid #660000;
    border-radius: 8px;
    font-size: 1.8rem;
    font-weight: bold;
    text-align: center;
    width: 80px;
    height: 50px;
}

.btn-reset {
    background: #330000;
    color: #ffffff;
    border: 2px solid #660000;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-reset:hover {
    background: #660000;
    border-color: #ff0000;
}

/* Roll Type Buttons */
.roll-type-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-roll-type {
    background: #330000;
    color: #ffffff;
    border: 2px solid #660000;
    border-radius: 8px;
    padding: 12px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-roll-type:hover {
    background: #660000;
    border-color: #ff0000;
}

.btn-roll-type.active {
    background: #ff0000;
    border-color: #ff0000;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.6);
}

/* Quick Rolls */
.quick-rolls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-quick-roll {
    background: #1a1a1a;
    color: #ff0000;
    border: 2px solid #660000;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.btn-quick-roll:hover {
    background: #330000;
    border-color: #ff0000;
    transform: translateX(5px);
}

.btn-clear-history {
    background: #1a0000;
    color: #ff0000;
    border: 2px solid #660000;
    border-radius: 8px;
    padding: 12px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-clear-history:hover {
    background: #660000;
    color: #ffffff;
    border-color: #ff0000;
}

/* === DICE PANEL === */
.dice-panel {
    background: #1a1a1a;
    border-radius: 15px;
    padding: 30px;
    border: 2px solid #660000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Result Display */
.result-display {
    background: #0a0a0a;
    border: 3px solid #660000;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.result-text {
    font-size: 3rem;
    font-weight: bold;
    color: #ff0000;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
}

/* Critical animations */
.result-display.critical-success {
    border-color: #00ff00;
    animation: pulse-success 1s ease-in-out;
}

.result-display.critical-fail {
    border-color: #ff0000;
    animation: pulse-fail 1s ease-in-out;
}

@keyframes pulse-success {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 0, 0.5); }
    50% { box-shadow: 0 0 30px rgba(0, 255, 0, 1); }
}

@keyframes pulse-fail {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 0, 0, 0.5); }
    50% { box-shadow: 0 0 30px rgba(255, 0, 0, 1); }
}

/* Dice Grid */
.dice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.dice-button {
    background: linear-gradient(135deg, #330000 0%, #660000 100%);
    border: 3px solid #ff0000;
    border-radius: 15px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.dice-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.dice-button:hover::before {
    width: 200px;
    height: 200px;
}

.dice-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 0, 0, 0.5);
    border-color: #ff3333;
}

.dice-button:active {
    transform: translateY(-2px) scale(0.98);
}

.dice-label {
    font-size: 2rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    z-index: 1;
}

/* Dice shake animation */
.dice-button.rolling {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    75% { transform: translateX(10px) rotate(5deg); }
}

/* === HISTORY PANEL === */
.history-panel {
    background: #1a1a1a;
    border-radius: 15px;
    padding: 20px;
    border: 2px solid #660000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    max-height: 600px;
    overflow-y: auto;
}

.history-panel h3 {
    color: #ff0000;
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: #0a0a0a;
    border: 2px solid #660000;
    border-radius: 8px;
    padding: 12px;
    animation: slideIn 0.3s ease-out;
}

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

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.history-dice {
    font-weight: bold;
    color: #ff0000;
}

.history-result {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffffff;
}

.history-details {
    font-size: 0.85rem;
    color: #999999;
    margin-top: 5px;
}

.history-item.critical-success {
    border-color: #00ff00;
    background: rgba(0, 255, 0, 0.05);
}

.history-item.critical-fail {
    border-color: #ff0000;
    background: rgba(255, 0, 0, 0.05);
}

/* Scrollbar Styling */
.history-panel::-webkit-scrollbar {
    width: 8px;
}

.history-panel::-webkit-scrollbar-track {
    background: #0a0a0a;
    border-radius: 10px;
}

.history-panel::-webkit-scrollbar-thumb {
    background: #660000;
    border-radius: 10px;
}

.history-panel::-webkit-scrollbar-thumb:hover {
    background: #ff0000;
}

/* === RESPONSIVE DESIGN === */

/* Tablet */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-areas:
            "dice"
            "controls"
            "history";
    }

    .dice-panel {
        grid-area: dice;
    }

    .controls-panel {
        grid-area: controls;
    }

    .history-panel {
        grid-area: history;
        max-height: 400px;
    }

    .title {
        font-size: 2.5rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }

    .header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .dice-panel {
        padding: 20px;
    }

    .dice-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .dice-button {
        min-height: 100px;
        padding: 20px 15px;
    }

    .dice-label {
        font-size: 1.5rem;
    }

    .result-display {
        padding: 30px 20px;
        min-height: 120px;
    }

    .result-text {
        font-size: 2rem;
    }

    .controls-panel,
    .history-panel {
        padding: 15px;
    }

    .btn-modifier {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    #modifierValue {
        width: 70px;
        height: 45px;
        font-size: 1.5rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .title {
        font-size: 1.5rem;
    }

    .dice-grid {
        grid-template-columns: 1fr;
    }

    .dice-button {
        min-height: 80px;
    }

    .result-text {
        font-size: 1.8rem;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .dice-button,
    .btn-modifier,
    .btn-roll-type,
    .btn-quick-roll {
        min-height: 44px;
        min-width: 44px;
    }
}
