:root {
   --color-primary: #264653;
   --color-secondary: #DAD7CD;
   --color-warning: #E9C46A;
   --color-danger: #DC3545;
   --color-bg: #F4A261;
   --color-bg-light: #FDEDE0;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: color-mix(in srgb, var(--color-bg) 30%, white);
    min-height: 100vh;
    color: var(--color-primary);

    &.modal-open {
        overflow: hidden;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: var(--color-bg-light);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;

    &:hover {
        transform: translateY(-1px);
        box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.3);
    }
}

.btn-primary {
    background: var(--color-primary);
    color: white;

    &:hover {
        background: color-mix(in srgb, var(--color-primary) 90%, white);
    }
}

.btn-secondary {
    background: var(--color-secondary);

    &:hover {
        background: color-mix(in srgb, var(--color-secondary) 90%, black);
    }
}

.btn-danger {
    background: var(--color-danger);
    color: white;

    &:hover {
        background: color-mix(in srgb, var(--color-danger) 90%, black);
    }
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Countdowns List */
.countdowns-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

@property --progress {
   syntax: '<percentage>';
   inherits: false;
   initial-value: 0%;
}

.countdown-card {
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;

    /* Progress */
    background: linear-gradient(var(--color-bg-light), var(--color-bg-light)) padding-box,
                conic-gradient(var(--color-primary) 0 var(--progress),
                               var(--color-bg-light) var(--progress) 100%) border-box;
    border: 4px solid transparent;
    transition: --progress 1s ease-in;
}

.countdown-header {
    align-items: center;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
}

/* Countdown card popover menu */
.countdown-menu {
    position: relative;
}

.countdown-menu-toggle {
    width: 32px;
    height: 32px;
    font-size: 20px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.countdown-popover {
    position: absolute;
    top: 34px;
    right: 0;
    min-width: 160px;
    background: color-mix(in srgb, var(--color-bg) 7%, white);;
    border: 1px solid var(--color-secondary);
    border-radius: 10px;
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.15);
    padding: 6px;
    display: none;
    z-index: 10;
}

.countdown-popover.open {
    display: block;
}

.popover-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--color-primary);
    font-size: 0.95rem;
}

.popover-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.popover-item.danger {
    color: var(--color-danger);
}

.countdown-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.countdown-display {
    text-align: center;
    margin-bottom: 20px;
}

.countdown-time {
    font-size: 2.5rem;
    font-weight: 700;
    color: color-mix(in srgb, var(--color-danger) 80%, black);
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
}

.countdown-details {
    border-radius: 10px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-weight: 500;
}

.countdown-footer {
   align-items: center;
   margin-top: 20px;
}

.countdown-actions {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: color-mix(in srgb, var(--color-secondary) 15%, white);
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--color-secondary);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 15px 15px 0 0;
}

.modal-header h2 {
    margin: 0;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 25px;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-secondary);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group input[type="time"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-date-time-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Skip Days Section */
.skip-days-section {
    border-radius: 10px;
    padding: 20px;
}

.skip-option {
    margin-bottom: 20px;
}

.skip-option:last-child {
    margin-bottom: 0;
}

.skip-option h4 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.checkbox-group label:hover {
    background-color: rgba(0, 0, 0, .1);
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

/* Date Ranges */
.date-range {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, .75);
    border-radius: 8px;
    border: 1px solid var(--color-secondary);
}

.date-range input[type="date"] {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--color-secondary);
    border-radius: 6px;
}

.date-range span {
    font-weight: 500;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--color-secondary);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    font-weight: 300;
}

.empty-state p {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 10px;
        padding: 6px 10px 10px 10px;
        margin-bottom: 10px;
        text-align: center;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .countdowns-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .countdown-card {
        padding: 10px 20px;
    }

    .countdown-header,
    .countdown-display {
        margin-bottom: 10px;
    }

    .countdown-time {
        font-size: 2rem;
    }
    
    .countdown-actions {
        justify-content: center;
        margin-top: 10px;
    }

    .countdown-actions .btn {
        flex: 1;
        min-width: 80px;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .checkbox-group {
        grid-template-columns: 1fr;
    }
    
    .date-range {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

/* PWA Install Button */
.install-btn {
    border-radius: 25px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.install-btn:hover {
    animation: none;
    transform: translateY(-2px);
}
