/* Tools Page Layout - Adapted from Games Page */
.tools-layout {
    display: flex;
    gap: 30px;
    margin-top: 30px;
    align-items: flex-start;
}


.tools-content {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.tool-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--main-color);
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.2);
    padding: 30px;
    box-sizing: border-box;
    backdrop-filter: blur(5px);

    /* Initially hidden via JS, but helpful defaults */
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Placeholder specific styles */
.tool-placeholder {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #aaa;
    font-style: italic;
}

.tool-placeholder i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--main-color);
    opacity: 0.7;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .tools-layout {
        flex-direction: column;
    }
}

/* Tool Header & Switcher */
.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.view-switcher {
    display: flex;
    gap: 10px;
}

.view-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover,
.view-btn.active {
    background: var(--main-color);
    color: #000;
    box-shadow: 0 0 10px var(--glow);
}

/* World Clock Styles */
.clock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
}

.clock-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.clock-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border-color: var(--main-color);
}

.clock-label {
    font-size: 0.9rem;
    color: var(--main-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 700;
}

.clock-time {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Roboto', sans-serif;
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.clock-offset {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 5px;
}

.clock-date {
    font-size: 0.85rem;
    color: #fff;
    opacity: 0.9;
}

/* List View Styles */
.clock-grid.list-view {
    grid-template-columns: 1fr;
    gap: 15px;
}

.clock-grid.list-view .clock-card {
    flex-direction: row;
    justify-content: space-between;
    padding: 15px 30px;
    align-items: center;
}

.clock-grid.list-view .clock-card:hover {
    transform: translateX(5px);
}

.clock-grid.list-view .clock-label {
    margin-bottom: 0;
    flex: 1;
    text-align: left;
    font-size: 1.1rem;
}

.clock-grid.list-view .clock-time {
    margin-bottom: 0;
    font-size: 1.8rem;
    flex: 1;
    text-align: center;
}

.clock-grid.list-view .clock-offset {
    margin-bottom: 0;
    flex: 1;
    text-align: center;
}

.clock-grid.list-view .clock-date {
    flex: 1;
    text-align: right;
}

/* Mobile adjustments for List View */
@media (max-width: 600px) {
    .clock-grid.list-view .clock-card {
        flex-direction: column;
        padding: 20px;
        text-align: center;
    }

    .clock-grid.list-view .clock-label,
    .clock-grid.list-view .clock-time,
    .clock-grid.list-view .clock-offset,
    .clock-grid.list-view .clock-date {
        text-align: center;
        margin-bottom: 5px;
        width: 100%;
    }
}

/* Add a subtle glow/gradient effect */
.clock-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.clock-card:hover::before {
    opacity: 1;
}

/* Drag and Drop Styles */
.clock-card {
    cursor: grab;
    position: relative;
    /* Ensure relative positioning for remove button */
}

/* ... existing styles ... */

.clock-card:active {
    cursor: grabbing;
}

.clock-card.dragging {
    opacity: 0.5;
    border: 2px dashed var(--main-color);
}

.clock-card.drag-over {
    transform: scale(1.02);
    box-shadow: 0 0 15px var(--glow);
    border-color: var(--accent-color);
}

/* Remove Button */
.remove-clock-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: transparent;
    border: none;
    color: #ff4444;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 5px;
    z-index: 10;
}

.clock-card:hover .remove-clock-btn {
    opacity: 1;
}

.remove-clock-btn:hover {
    color: #ff0000;
    transform: scale(1.1);
}

/* Add Button in Header */
.add-clock-btn {
    background: transparent;
    border: 1px solid var(--main-color);
    color: var(--main-color);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
}

.add-clock-btn:hover {
    background: var(--main-color);
    color: #000;
    box-shadow: 0 0 10px var(--glow);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-color);
    border: 1px solid var(--main-color);
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.2);
    text-align: center;
}

.modal-content h3 {
    margin-top: 0;
    color: var(--main-color);
}

.modal-content select {
    width: 100%;
    padding: 10px;
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #444;
    color: #fff;
    border-radius: 5px;
}

.modal-content select option {
    background: #000;
    color: #fff;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.modal-btn.cancel {
    background: #555;
    color: #fff;
}

.modal-btn.confirm {
    background: var(--main-color);
    color: #000;
}

/* Stopwatch Styles */
.stopwatch-display {
    font-size: 4rem;
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    color: #fff;
    margin: 30px 0;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.5);
    background: rgba(0, 0, 0, 0.3);
    padding: 20px 40px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stopwatch-display-secondary {
    font-size: 2rem;
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 20px;
    margin-top: -15px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: none;
    /* Hidden by default until active */
}

.stopwatch-display-secondary .milliseconds {
    font-size: 1.2rem;
    color: #fff;
    opacity: 0.7;
}

.stopwatch-display .milliseconds {
    font-size: 2.5rem;
    color: #fff;
    opacity: 0.7;
}

.stopwatch-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.tool-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tool-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.tool-btn.start {
    background: linear-gradient(135deg, #00c853, #009624);
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.3);
}

.tool-btn.stop {
    background: linear-gradient(135deg, #d50000, #b71c1c);
    box-shadow: 0 4px 15px rgba(213, 0, 0, 0.3);
}

.tool-btn.lap {
    background: linear-gradient(135deg, #2979ff, #2962ff);
    box-shadow: 0 4px 15px rgba(41, 121, 255, 0.3);
}

.tool-btn.reset {
    background: linear-gradient(135deg, #757575, #424242);
    box-shadow: 0 4px 15px rgba(117, 117, 117, 0.3);
}

.tool-btn:not(:disabled):hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.tool-btn:not(:disabled):active {
    transform: translateY(0);
}

.stopwatch-laps {
    width: 100%;
    max-width: 500px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.laps-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    font-weight: bold;
    color: var(--main-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#sw-laps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 250px;
    overflow-y: auto;
}

#sw-laps-list li {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #ddd;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
}

#sw-laps-list li:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

#sw-laps-list li .lap-fastest {
    color: #00e676;
}

#sw-laps-list li .lap-slowest {
    color: #ff5252;
}

/* Scrollbar for laps */
#sw-laps-list::-webkit-scrollbar {
    width: 6px;
}

#sw-laps-list::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .stopwatch-display {
        font-size: 2.5rem;
        padding: 15px 20px;
    }

    .stopwatch-display .milliseconds {
        font-size: 1.5rem;
    }

    .stopwatch-controls {
        gap: 10px;
    }

    .tool-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        flex: 1 1 40%;
        /* Make buttons take up clearer space */
        justify-content: center;
    }
}

/* Countdown Timer Styles */
.timer-display {
    font-size: 5rem;
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    color: #fff;
    margin: 30px 0;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.5);
    display: none;
    /* Hidden initially, shown when running/set */
}

.timer-display.time-up {
    color: #ff4444;
    text-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
    animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.timer-input-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-group input {
    width: 80px;
    height: 80px;
    font-size: 3rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-family: 'Roboto Mono', monospace;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--main-color);
    box-shadow: 0 0 15px var(--glow);
}

/* Try to remove spinner buttons */
.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-group label {
    margin-top: 10px;
    color: #888;
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: bold;
}

.input-separator {
    font-size: 3rem;
    color: #666;
    margin-bottom: 25px;
    /* Adjust for label */
}

.timer-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

/* Timer Presets */
.timer-presets {
    margin-top: 30px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.timer-presets p {
    color: var(--main-color);
    margin-bottom: 15px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

.presets-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.preset-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Roboto', sans-serif;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.preset-btn:hover {
    background: var(--main-color);
    color: #000;
    border-color: var(--main-color);
    box-shadow: 0 0 15px var(--glow);
    transform: translateY(-2px);
}

.preset-btn:active {
    transform: translateY(0);
}