/* DigiBoard specific styles */

/* Main Container */
#digiboard-container {
    position: relative;
    width: 100%;
    height: 100vh;
    /* Takes full viewport height minus header if needed, but absolute positioning handles it better usually */
    background-color: var(--bg-color);
    /* Theme background */
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

/* Toolbar (Dock) */
.digiboard-toolbar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    display: flex;
    gap: 0.8rem;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    justify-content: center;
    max-width: 95vw;
}

.digiboard-tool-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.5rem;
    border-radius: 8px;
    position: relative;
}

.digiboard-tool-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
}

.digiboard-tool-btn span {
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Widget Window */
.widget-window {
    position: absolute;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    min-width: 200px;
    min-height: 150px;
    backdrop-filter: blur(12px);
    color: white;
    transition: box-shadow 0.2s;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.widget-window.active {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7), 0 0 0 2px var(--primary);
    z-index: 1000;
    /* Ensure active is on top */
}

/* Widget Header */
.widget-header {
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.8rem;
    cursor: grab;
    /* Drag handle */
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.widget-header:active {
    cursor: grabbing;
}

.widget-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
    /* Let drag pass through */
}

.widget-controls {
    display: flex;
    gap: 0.5rem;
}

.widget-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.widget-btn.close:hover {
    background: #ef4444;
}

/* Widget Content */
.widget-content {
    flex: 1;
    padding: 1rem;
    overflow: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Resize Handle (Optional) */
.widget-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.3) 50%);
    border-bottom-right-radius: 12px;
}

/* --- Specific Widget Styling --- */

/* Timer */
.timer-display {
    font-size: 3rem;
    font-weight: 700;
    font-family: monospace;
    margin: 1rem 0;
}

/* Traffic Light */
.traffic-light {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #222;
    padding: 1rem;
    border-radius: 10px;
}

.light {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #444;
    transition: all 0.3s;
    cursor: pointer;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.light.red.active {
    background: #ff4444;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
}

.light.yellow.active {
    background: #ffcc00;
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.6);
}

.light.green.active {
    background: #00cc66;
    box-shadow: 0 0 20px rgba(0, 204, 102, 0.6);
}

/* Symbols */
.symbol-display {
    text-align: center;
}

.symbol-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 1rem;
    fill: currentColor;
    transition: transform 0.2s;
}

.symbol-text {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Drawing */
.drawing-canvas {
    background: white;
    border-radius: 4px;
    cursor: crosshair;
    touch-action: none;
}

.drawing-tools {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: 8px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
}

.color-swatch.active {
    border-color: white;
    transform: scale(1.1);
}

/* Random Name */
.random-name-input {
    width: 100%;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    resize: none;
    font-family: inherit;
}

.name-display {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: zoomFull 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dice */
.dice-container {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.die {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.3s;
}

.die svg {
    width: 100%;
    height: 100%;
}

.die.rolling {
    animation: roll 0.5s ease-in-out;
}

@keyframes roll {
    0% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(15deg);
    }

    50% {
        transform: rotate(-15deg);
    }

    75% {
        transform: rotate(5deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

/* Text Editor */
.text-editor {
    width: 100%;
    height: 100%;
    min-height: 100px;
    background: transparent;
    color: white;
    border: none;
    outline: none;
    font-size: 1rem;
    overflow-y: auto;
}

/* Burger Menu & Dropdown */
.digiboard-menu-container {
    position: relative;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.digiboard-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 2001;
}

.digiboard-dropdown.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.digiboard-dropdown-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 0.8rem 1rem;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.digiboard-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.digiboard-dropdown-btn svg {
    width: 20px;
    height: 20px;
}

.digiboard-dropdown-btn.danger {
    color: #ff6b6b;
}

.digiboard-dropdown-btn.danger:hover {
    background: rgba(255, 107, 107, 0.15);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}