/* --- Color Palette & Global Variables --- */
:root {
    --green: #22c55e;
    --yellow: #facc15;
    --red: #ef4444;
    --darkred: #991b1b;
    --bg: #0f172a;
    
    /* Variables for high-contrast text */
    --text-primary: #f8fafc;     /* For main text */
    --text-secondary: #e2e8f0;   /* Brighter grey for labels & secondary info */
    --text-dark: #0f172a;        /* For use on light backgrounds like yellow */
    
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.25);
    --panel-bg: rgba(30, 41, 59, 0.7);
    --cancel-btn: #475569;
    --export-btn: #2d3748;
}

/* --- Base Styles & Modern Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    transition: background-color 0.8s ease;
    gap: 1.25rem;
    padding: 1.5rem;
}

/* --- Typography & Info Sections --- */
.info-container {
    text-align: center;
    max-width: 600px;
}

.info-container h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.info-container p {
    font-size: 1rem;
    line-height: 1.5;
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

.info-details {
    width: 100%;
    max-width: 600px;
    background-color: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.info-details summary {
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    padding: 0.5rem 0;
    transition: color 0.2s ease;
}

.info-details summary::marker,
.info-details summary::-webkit-details-marker {
    display: none;
}
.info-details summary::before {
    content: '+';
    font-size: 1.2rem;
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
    display: inline-block;
    color: var(--yellow);
}

.info-details[open] summary {
    color: var(--yellow);
}

.info-details[open] summary::before {
    transform: rotate(45deg);
}

.info-details .info-content {
    padding: 0.5rem 0 1rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}
.info-details .info-content ul {
    list-style-type: none;
    padding-left: 0;
}
.info-details .info-content li {
    margin-bottom: 0.2rem;
}

.info-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

/* --- Main Timer Display --- */
#timer {
    font-size: clamp(3rem, 15vw, 5rem);
    font-weight: 700;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

#timer .unit {
    font-style: normal;
    font-size: 0.3em;
    font-weight: 400;
    color: var(--text-secondary);
    margin: 0 0.1em;
}

/* --- Main Controls Panel --- */
.controls-wrapper {
    width: 100%;
    max-width: 600px;
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px var(--shadow);
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.time-input-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.time-input-container > label {
    font-weight: 600;
}

.time-input-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 0.5rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.time-input-group:focus-within {
    border-color: var(--yellow);
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}

.time-input-group input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    text-align: center;
    font-size: 1rem;
    padding: 0.6rem 0.2rem;
    outline: none;
    -moz-appearance: textfield;
}

.time-input-group input::-webkit-outer-spin-button,
.time-input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.time-input-group .unit {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.full-width {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

input[type="text"] {
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus {
    border-color: var(--yellow);
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}

/* --- Action Buttons --- */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

button {
    padding: 0.9rem 1.6rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

#mainActionBtn {
    background: linear-gradient(145deg, var(--green), #16a34a);
    grid-column: 1 / -1;
}

#mainActionBtn.stop-mode {
    background: linear-gradient(145deg, var(--red), var(--darkred));
    grid-column: auto;
}

#cancelBtn { 
    background: var(--cancel-btn);
}

#exportBtn { 
    background: var(--export-btn); 
    margin-top: 1rem; 
}

/* --- Speakers List --- */
#speakersListContainer {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px var(--shadow);
}

#speakersListContainer h3 {
    margin: 0 0 0.75rem 0;
    color: var(--yellow);
}

#speakersList {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

#speakersList::-webkit-scrollbar { width: 8px; }
#speakersList::-webkit-scrollbar-track { background: var(--bg); border-radius: 8px; }
#speakersList::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
#speakersList::-webkit-scrollbar-thumb:hover { background: #475569; }

#noSpeakersMsg { color: var(--text-secondary); }

.speaker-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}

.speaker-entry:last-of-type { border-bottom: none; }

.speaker-entry-info { display: flex; align-items: center; gap: 0.75rem; }
.speaker-entry-info .number { font-weight: 700; color: var(--yellow); width: 20px; text-align: right; }
.speaker-entry-info .name { word-break: break-all; }
.speaker-entry-controls { display: flex; align-items: center; gap: 1rem; }
.speaker-entry .time { font-weight: 600; }

.delete-btn {
    background: none; border: none; color: #ef4444; font-size: 1.2rem; cursor: pointer;
    padding: 0; transition: transform 0.2s, color 0.2s;
}
.delete-btn:hover { transform: scale(1.2); color: #b91c1c; }

/* --- Sound Toggle Switch --- */
.toggle-container {
    display: flex;
    align-items: center;
    justify-self: center;
    gap: 0.6rem;
    cursor: pointer;
}

.slider {
    position: relative; width: 46px; height: 26px; background-color: #475569;
    border-radius: 26px; transition: background-color 0.4s; box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}
.slider:before {
    position: absolute; content: ''; height: 18px; width: 18px; left: 4px; bottom: 4px;
    background-color: white; transition: transform 0.4s; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.toggle-container input { display: none; }
input:checked + .slider { background-color: var(--green); }
input:checked + .slider:before { transform: translateX(20px); }

/* --- Media Queries for Responsiveness --- */
@media (max-width: 480px) {
    body { padding: 1rem; }
    .input-grid { grid-template-columns: 1fr; }
    .button-group { grid-template-columns: 1fr 1fr; }
    .time-input-container { align-items: center; }
}
