.time-tools-wrapper {
    max-width: 600px;
    margin: 0 auto 40px;
    padding: 20px;
    background: #222;
    color: #eee;
    border-radius: 12px;
}

.time-tools-wrapper .time-tabs {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.time-tools-wrapper .tab-btn {
    flex: 1;
    padding: 10px;
    background: #444;
    border: none;
    cursor: pointer;
    color: #ccc;
    font-weight: 500;
}

.time-tools-wrapper .tab-btn:hover,
.time-tools-wrapper .tab-btn:focus,
.time-tools-wrapper .tab-btn:active {
    background: #444;
    color: #ccc;
    border: none;
}

.time-tools-wrapper .tab-active,
.time-tools-wrapper .tab-active:hover,
.time-tools-wrapper .tab-active:focus,
.time-tools-wrapper .tab-active:active {
    background: #666;
    color: #fff;
}

.time-tools-wrapper .tool-section {
    display: none;
}

.time-tools-wrapper .tool-section:not(.hidden) {
    display: block;
}

.time-tools-wrapper .tool-title {
    text-align: center;
    margin-bottom: 15px;
    font-size: 24px;
}

.time-tools-wrapper .time-display {
    font-size: 42px;
    text-align: center;
    margin-bottom: 20px;
    font-family: monospace;
}

.time-tools-wrapper .input-block {
    text-align: center;
    margin-bottom: 20px;
}

.time-tools-wrapper .format-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.time-tools-wrapper .radio-option {
    display: flex;
    align-items: center;
    gap: 5px;
}

.time-tools-wrapper .input-block input[type="radio"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    margin: 0;
}

.time-tools-wrapper .radio-option label {
    cursor: pointer;
}

.time-tools-wrapper .time-input {
    padding: 8px;
    font-size: 17px;
    border-radius: 6px;
    border: 1px solid #555;
    background: #333;
    color: #fff;
    color-scheme: dark;
    margin: 5px;
}

.time-tools-wrapper #alarm-duration,
.time-tools-wrapper #timer-duration,
.time-tools-wrapper #alarm-repeat-select,
.time-tools-wrapper #timer-type-select {
    /* Slightly increase width for better text visibility */
    width: 150px;
}

.time-tools-wrapper #timer-datetime-picker-block .time-input {
    /* Allow date/time inputs to size naturally */
    width: auto;
    flex-grow: 1;
}

.time-tools-wrapper .time-input:hover,
.time-tools-wrapper .time-input:focus,
.time-tools-wrapper .time-input:active {
    background-color: #333;
    border: 1px solid #555;
    color: #fff;
}

.time-tools-wrapper .time-input:focus,
.time-tools-wrapper .time-input:active {
    border-color: #666;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

/* Hide spinners from number inputs */
.time-tools-wrapper input[type=number]::-webkit-inner-spin-button,
.time-tools-wrapper input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.time-tools-wrapper input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.time-tools-wrapper select.time-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8L10 12L14 8' stroke='%23CCCCCC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 25px;
    /* Make space for the arrow */
}

.time-tools-wrapper .time-input.small {
    width: 80px;
}

.time-tools-wrapper #timer-hour,
.time-tools-wrapper #timer-min,
.time-tools-wrapper #timer-sec {
    text-align: center;
}

.time-tools-wrapper .time-picker-container {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.time-tools-wrapper .time-picker-separator {
    font-weight: bold;
}

.time-tools-wrapper .btn-group {
    text-align: center;
    margin-bottom: 15px;
}

.time-tools-wrapper .btn {
    padding: 10px 15px;
    border: none;
    margin: 5px;
    border-radius: 6px;
    cursor: pointer;
    color: #fff;
    font-weight: 500;
}

.time-tools-wrapper .btn-green,
.time-tools-wrapper .btn-green:hover,
.time-tools-wrapper .btn-green:focus,
.time-tools-wrapper .btn-green:active {
    background-color: #1e7e4d;
    color: #fff;
}

.time-tools-wrapper .btn-red,
.time-tools-wrapper .btn-red:hover,
.time-tools-wrapper .btn-red:focus,
.time-tools-wrapper .btn-red:active {
    background-color: #b83224;
    color: #fff;
}

.time-tools-wrapper .btn-blue,
.time-tools-wrapper .btn-blue:hover,
.time-tools-wrapper .btn-blue:focus,
.time-tools-wrapper .btn-blue:active {
    background-color: #206694;
    color: #fff;
}

.time-tools-wrapper .btn-yellow,
.time-tools-wrapper .btn-yellow:hover,
.time-tools-wrapper .btn-yellow:focus,
.time-tools-wrapper .btn-yellow:active {
    background-color: #d4ac0d;
    color: #000;
}

.time-tools-wrapper .btn-purple,
.time-tools-wrapper .btn-purple:hover,
.time-tools-wrapper .btn-purple:focus,
.time-tools-wrapper .btn-purple:active {
    background-color: #7d3c98;
    color: #fff;
}

.time-tools-wrapper .btn-dark,
.time-tools-wrapper .btn-dark:hover,
.time-tools-wrapper .btn-dark:focus,
.time-tools-wrapper .btn-dark:active {
    background-color: #6c757d;
    color: #fff;
}

/* --- Theme Override ---
     * The following rules ensure that WordPress theme styles for common interactive
     * states (:hover, :focus, :active) do not affect the custom appearance of this tool.
    */

/* Remove theme-applied outlines from all interactive elements on focus/active */
.time-tools-wrapper .btn:focus,
.time-tools-wrapper .tab-btn:focus,
.time-tools-wrapper .time-input:focus,
.time-tools-wrapper .btn-edit-alarm:focus,
.time-tools-wrapper .btn-delete-alarm:focus,
.time-tools-wrapper .btn:active,
.time-tools-wrapper .tab-btn:active,
.time-tools-wrapper .time-input:active,
.time-tools-wrapper .btn-edit-alarm:active,
.time-tools-wrapper .btn-delete-alarm:active {
    outline: none;
}

/* Remove theme-applied box-shadows from buttons on focus/active */
.time-tools-wrapper .btn:focus,
.time-tools-wrapper .tab-btn:focus,
.time-tools-wrapper .btn-edit-alarm:focus,
.time-tools-wrapper .btn-delete-alarm:focus,
.time-tools-wrapper .btn:active,
.time-tools-wrapper .tab-btn:active,
.time-tools-wrapper .btn-edit-alarm:active,
.time-tools-wrapper .btn-delete-alarm:active {
    box-shadow: none;
}

.time-tools-wrapper .status-msg {
    text-align: center;
    margin-top: 10px;
    font-size: 16px;
    color: #bbb;
}

.time-tools-wrapper .laps {
    margin-top: 15px;
    padding: 10px;
    background: #333;
    border-radius: 8px;
}

.time-tools-wrapper .laps h3 {
    margin-bottom: 10px;
}

.time-tools-wrapper .laps ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.time-tools-wrapper .laps li {
    border-bottom: 1px solid #444;
}

.time-tools-wrapper .laps-header,
.time-tools-wrapper .laps li {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;
    font-size: 16px;
    /* Increased font size for readability */
}

.time-tools-wrapper .laps-header {
    font-weight: 500;
    border-bottom: 2px solid #666;
}

.time-tools-wrapper .laps-header span,
.time-tools-wrapper .laps li span {
    flex: 1;
    text-align: center;
    /* Centered all columns */
}

.time-tools-wrapper .laps-live-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;
    font-size: 16px;
    color: #ffc107;
    /* Highlight color for the live lap */
}

.time-tools-wrapper .laps-live-row span {
    flex: 1;
    text-align: center;
}

.time-tools-wrapper .hidden {
    display: none;
}

.time-tools-wrapper .drag-drop-area {
    position: relative;
    border: 2px dashed #555;
    border-radius: 8px;
    padding: 25px;
    padding-bottom: 45px;
    /* Make space for the info text */
    display: inline-block;
    width: 90%;
    max-width: 400px;
    transition: border-color 0.3s, background-color 0.3s;
    box-sizing: border-box;
}

.time-tools-wrapper .drag-drop-area p:not(.drag-drop-info) {
    margin: 0 0 15px;
}

.time-tools-wrapper .drag-drop-area.drag-over {
    border-color: #2ecc71;
    background-color: #333;
}

.time-tools-wrapper .drag-drop-info {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    margin: 0;
    padding: 0 15px;
    box-sizing: border-box;
}

.time-tools-wrapper .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin-top: -15px;
    margin-left: -15px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

.time-tools-wrapper .drag-drop-area.loading>*:not(.spinner) {
    visibility: hidden;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes flash-effect {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.02);
    }
}

.time-tools-wrapper .alarm-ringing-effect {
    display: block;
    font-weight: 500;
    color: #ffc107;
    /* Warning Yellow */
    animation: flash-effect 1.2s infinite ease-in-out;
}

/* --- Ringing Alarm Display --- */
.time-tools-wrapper .ringing-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px 0;
}

.time-tools-wrapper .ringing-icon {
    font-size: 48px;
    animation: flash-effect 1.2s infinite ease-in-out;
}

.time-tools-wrapper .ringing-message {
    font-size: 20px;
    font-weight: 500;
    color: #ffc107;
}

.time-tools-wrapper .timer-end-time-display {
    text-align: center;
    font-size: 16px;
    color: #bbb;
    margin-top: -15px;
    margin-bottom: 20px;
}

/* --- Your Alarms List --- */
.time-tools-wrapper .your-alarms-container {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #444;
}

.time-tools-wrapper .your-alarms-title {
    text-align: center;
    font-size: 19px;
    margin-bottom: 15px;
}

.time-tools-wrapper #alarms-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.time-tools-wrapper .alarm-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #333;
    padding: 10px 15px;
    border-radius: 8px;
}

.time-tools-wrapper .alarm-details {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.time-tools-wrapper .alarm-item-time {
    font-size: 20px;
    font-weight: 500;
}

.time-tools-wrapper .alarm-item-repeat {
    font-size: 14px;
    color: #bbb;
    text-transform: capitalize;
}

.time-tools-wrapper .alarm-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.time-tools-wrapper .btn-delete-alarm {
    background: none;
    border: none;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.time-tools-wrapper .btn-delete-alarm:hover,
.time-tools-wrapper .btn-delete-alarm:focus,
.time-tools-wrapper .btn-delete-alarm:active {
    color: #ff6b6b;
    background: none;
    /* Explicitly override theme styles */
    border: none;
    /* Explicitly override theme styles */
}

.time-tools-wrapper .btn-edit-alarm {
    background: none;
    border: none;
    color: #aaa;
    /* This will be the SVG stroke color */
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-tools-wrapper .btn-edit-alarm:hover,
.time-tools-wrapper .btn-edit-alarm:focus,
.time-tools-wrapper .btn-edit-alarm:active {
    color: #76c7ff;
    background: none;
    /* Explicitly override theme styles */
    border: none;
    /* Explicitly override theme styles */
}

.time-tools-wrapper .btn-edit-alarm svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    /* Inherit color from parent button */
}

/* --- Toggle Switch CSS --- */
.time-tools-wrapper .switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.time-tools-wrapper .switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.time-tools-wrapper .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #666;
    transition: .4s;
}

.time-tools-wrapper .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

.time-tools-wrapper input:checked+.slider {
    background-color: #1e7e4d;
}

.time-tools-wrapper input:checked+.slider:before {
    transform: translateX(20px);
}

.time-tools-wrapper .slider.round {
    border-radius: 24px;
}

.time-tools-wrapper .slider.round:before {
    border-radius: 50%;
}

.faq-list {
    margin-top: 1rem;
}

.faq-list dt {
    font-weight: 600;
    font-size: 1.1em;
}

.faq-list dd {
    margin-left: 0;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
    padding-bottom: 10px;
    border-bottom: 1px dashed #ddd;
}

@media (max-width: 767px) {

    .time-tools-wrapper {
        padding: 20px 0;
    }

    .time-tools-wrapper .laps-live-row {
        padding: 5px 0;
    }

    .time-tools-wrapper .laps-header,
    .time-tools-wrapper .laps li {
        padding: 5px 0;
    }

    .time-tools-wrapper .laps-header span,
    .time-tools-wrapper .laps li span {
        /* On mobile, left-align text for better readability in columns */
        text-align: center;
    }

    /* Adjust column widths to create clear gaps and prevent text from
           bunching up on narrow screens. */
    .time-tools-wrapper .laps-header span:nth-child(1),
    .time-tools-wrapper .laps li span:nth-child(1),
    .time-tools-wrapper .laps-live-row span:nth-child(1) {
        flex: 0.4;
    }

    /* Lap # */
    .time-tools-wrapper .laps-header span:nth-child(2),
    .time-tools-wrapper .laps li span:nth-child(2),
    .time-tools-wrapper .laps-live-row span:nth-child(2) {
        flex: 1.2;
    }

    /* Lap Time */
    .time-tools-wrapper .laps-header span:nth-child(3),
    .time-tools-wrapper .laps li span:nth-child(3),
    .time-tools-wrapper .laps-live-row span:nth-child(3) {
        flex: 1.2;
    }

    /* Total Time */

    /* Add extra spacing in drag-drop area on mobile */
    .time-tools-wrapper .drag-drop-area {
        padding-bottom: 60px;
    }

    /* Add custom arrow to date/time inputs on mobile to mimic select fields */
    .time-tools-wrapper #timer-date-input,
    .time-tools-wrapper #timer-time-input {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8L10 12L14 8' stroke='%23CCCCCC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 8px center;
        padding-right: 30px;
    }
}