/* ===== Timer Layout ===== */

.timer-block-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 18px;
    align-items: start;
}

.timer-mini-grid {
    display: grid;
    grid-template-columns: 1fr 105px 72px;
    gap: 6px;
    align-items: center;
}

.timer-panel {
    margin-top: 8px;
}

.timer-block {
    padding: 4px 0;
}

/* ===== Timer Controls ===== */

.timer-input {
    height: 30px;
    padding: 2px 6px;
    border: 1px solid #bfbfbf;
    border-radius: 0;
    background-color: #fff;
    font-size: 13px;
    color: #1f4e79;
}

.timer-input:focus {
    border-color: #999;
    box-shadow: none;
}

.timer-small-input {
    width: 100%;
}

.timer-clock-btn {
    width: 32px;
    min-width: 32px;
    height: 30px;
    padding: 0;
    border: 1px solid #bfbfbf;
    border-radius: 4px;
    background-color: #f7f7f7;
    color: #6c8fb6;
    font-size: 13px;
    justify-self: start;
}

.timer-clock-btn:hover {
    background-color: #ececec;
    color: #4f739c;
}

.timer-action-btn {
    width: 100%;
    height: 30px;
    border: 1px solid #c63d00;
    border-radius: 0;
    background-color: #d83f00;
}

.timer-action-btn:hover {
    background-color: #bf3800;
    border-color: #bf3800;
}

.timer-result-box {
    width: 100%;
    height: 30px;
    padding: 2px 6px;
    border: 1px solid #c63d00;
    border-radius: 0;
    background-color: #d83f00;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

.timer-result-box:focus {
    box-shadow: none;
    border-color: #c63d00;
    outline: none;
}

.timer-check-btn {
    width: 32px;
    min-width: 32px;
    height: 30px;
    padding: 0;
    border: 1px solid #8dc79c;
    border-radius: 8px;
    background-color: #f4fff6;
    color: #34a853;
    font-size: 18px;
    font-weight: 700;
}

.timer-check-btn:hover {
    background-color: #ebffef;
    color: #2c8f47;
    border-color: #7fbd8f;
}

/* ===== Timer State Colors ===== */

.timer-field-active {
    background-color: #dff5df !important;
    color: #2d5130;
    font-weight: 600;
}

.timer-field-running {
    background-color: #dff5df !important;
    color: #2d5130;
    font-weight: 600;
}

.timer-field-stopped {
    background-color: #f6dede !important;
    color: #5a3b3b;
    font-weight: 600;
}

.timer-break-running {
    background-color: #ffffff !important;
    color: #2d5130;
    font-weight: 600;
}

.timer-break-stopped {
    background-color: #ffffff !important;
    color: #5a3b3b;
    font-weight: 600;
}

/* ===== Add Timer Button ===== */

.timer-add-row {
    margin-top: 18px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.add-timer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    min-width: 32px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, #23b04a, #15933a);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(21, 147, 58, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.add-timer-btn:hover {
    background: linear-gradient(135deg, #27bd50, #138536);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(21, 147, 58, 0.22);
}

.add-timer-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
}

/* ===== Modal ===== */

.add-timer-modal {
    position: relative;
    border-radius: 16px;
    border: 0;
    overflow: visible;
}

.create-timer-btn {
    background: #15933a;
    color: #fff;
    border: 1px solid #15933a;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
}

.create-timer-btn:hover {
    background: #11752e;
    border-color: #11752e;
    color: #fff;
}

.project-picker {
    position: relative;
}

.project-picker-toggle {
    width: 100%;
    min-height: 42px;
    display: block;
    padding: 9px 42px 9px 14px;
    border: 1px solid #ced4da;
    border-radius: 10px;
    background: #fff;
    color: #1f2937;
    text-align: left;
    font-size: 16px;
    line-height: 1.3;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.project-picker-toggle span {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.project-picker-toggle:hover,
.project-picker-toggle:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
    outline: none;
}

.project-picker-placeholder {
    color: #6c757d;
}

.project-picker-icon {
    position: absolute;
    top: 13px;
    right: 14px;
    color: #495057;
    pointer-events: none;
}

.project-picker-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 1065;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 14px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.project-picker-search-wrap {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(180deg, #fafbfc 0%, #f4f6f8 100%);
}

.project-picker-search {
    border-radius: 10px;
}

.project-picker-table-wrap {
    max-height: 280px;
    overflow: auto;
}

.project-picker-table {
    margin-bottom: 0;
    table-layout: fixed;
}

.project-picker-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f3f6f9;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #d7dde4;
}

.project-picker-table th,
.project-picker-table td {
    padding: 9px 12px;
    vertical-align: top;
}

.project-picker-table th:nth-child(1),
.project-picker-table td:nth-child(1) {
    width: 88px;
    white-space: nowrap;
}

.project-picker-table th:nth-child(2),
.project-picker-table td:nth-child(2) {
    width: 180px;
}

.project-picker-table td:nth-child(2),
.project-picker-table td:nth-child(3) {
    word-break: break-word;
}

.client-picker-table th:nth-child(1),
.client-picker-table td:nth-child(1) {
    width: auto;
    white-space: nowrap;
}

.project-picker-row {
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.project-picker-row:hover,
.project-picker-row:focus {
    background: #eef5ff;
    outline: none;
}

.project-picker-row.is-selected {
    background: #dceafe;
    color: #0f3d8a;
    font-weight: 600;
}

/* ===== Dynamic Timer Cards ===== */

.dynamic-timers-container {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(4, minmax(340px, 1fr));
    gap: 14px;
    align-items: stretch;
    overflow-x: auto;
    padding-bottom: 4px;
}

.dynamic-timer-card {
    width: 100%;
    min-width: 0;
    max-width: none;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
    border: 1px solid rgba(210, 214, 220, 0.9);
    border-radius: 22px;
    padding: 18px 18px 16px;
    box-shadow:
        0 12px 28px rgba(15, 23, 42, 0.08),
        0 2px 6px rgba(15, 23, 42, 0.04);
}

.dynamic-timer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.dynamic-timer-header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

.dynamic-timer-header-main {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.dynamic-timer-logo {
    width: 145px;
    height: 76px;
    object-fit: contain;
    background: linear-gradient(180deg, #ffffff 0%, #f6f7fb 100%);
    border: 1px solid #e3e6ec;
    border-radius: 16px;
    padding: 10px 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.dynamic-timer-title-wrap {
    min-width: 0;
    max-width: 100%;
}

.dynamic-timer-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dynamic-timer-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timer-remove-btn {
    flex: 0 0 auto;
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #d86b6b;
    border-radius: 999px;
    background: linear-gradient(180deg, #fff5f5 0%, #ffdede 100%);
    color: #b42318;
    font-size: 24px;
    line-height: 1;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(180, 35, 24, 0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.timer-remove-btn:hover {
    background: linear-gradient(180deg, #ffe9e9 0%, #ffcaca 100%);
    color: #991b1b;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(180, 35, 24, 0.18);
}

.timer-remove-btn:focus {
    outline: none;
    box-shadow:
        0 0 0 0.2rem rgba(220, 38, 38, 0.18),
        0 8px 16px rgba(180, 35, 24, 0.18);
}

.timer-end-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #d7e0f0;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
    color: #4b5d7a;
    font-size: 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 4px 10px rgba(15, 23, 42, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.timer-end-btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #e7f0ff 100%);
    color: #29446d;
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 6px 12px rgba(15, 23, 42, 0.08);
}

.timer-end-btn:focus {
    outline: none;
    box-shadow:
        0 0 0 0.18rem rgba(59, 130, 246, 0.12),
        0 6px 12px rgba(15, 23, 42, 0.08);
}

.dynamic-timer-grid-large {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(170px, 200px) minmax(96px, 108px);
    gap: 10px 10px;
    align-items: center;
}

.dynamic-timer-card .form-select,
.dynamic-timer-card .form-control {
    min-width: 0;
    min-height: 30px;
    border-radius: 12px;
    border-color: #d9dee8;
    background-color: #fff;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.65);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dynamic-timer-card .form-select {
    padding-right: 22px;
}

.dynamic-timer-card .form-select:focus,
.dynamic-timer-card .form-control:focus {
    border-color: #b7c6ff;
    box-shadow:
        0 0 0 0.18rem rgba(59, 130, 246, 0.12),
        inset 0 1px 1px rgba(255, 255, 255, 0.65);
}

/* ===== Blue Result Box ===== */

.timer-result-box-blue {
    width: 100%;
    min-width: 0;
    height: 30px;
    background: linear-gradient(180deg, #2a47ff 0%, #142cff 100%);
    border: 1px solid #0f1ed1;
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.3px;
    text-align: right;
    padding: 4px 10px;
    border-radius: 10px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.15);
    transition: all 0.15s ease;
}

.timer-running .timer-result-box-blue {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 0 6px rgba(42, 71, 255, 0.45);
}

.timer-auto-debug {
    margin-top: 8px;
    min-height: 16px;
    color: #5d6673;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 11px;
    line-height: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 1201px) {
    .dynamic-timers-container {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
    }

    .dynamic-timer-card {
        padding: 16px 16px 14px;
        border-radius: 20px;
    }

    .dynamic-timer-header {
        gap: 12px;
        margin-bottom: 12px;
    }

    .dynamic-timer-header-main {
        gap: 12px;
    }

    .dynamic-timer-logo {
        width: 118px;
        height: 62px;
        padding: 8px 10px;
    }

    .dynamic-timer-title {
        font-size: 14px;
    }

    .dynamic-timer-subtitle {
        font-size: 12px;
    }

    .dynamic-timer-grid-large {
        grid-template-columns: minmax(0, 1fr) 148px 90px;
        gap: 8px;
    }

    .dynamic-timer-card .form-select,
    .dynamic-timer-card .form-control,
    .timer-result-box-blue {
        min-height: 28px;
        height: 28px;
        font-size: 12px;
    }

    .timer-result-box-blue {
        padding: 3px 9px;
    }
}

@media (min-width: 3000px) {
    .dynamic-timers-container {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
    }

    .dynamic-timer-card {
        padding: 14px 14px 12px;
        border-radius: 18px;
    }

    .dynamic-timer-header {
        gap: 10px;
        margin-bottom: 10px;
    }

    .dynamic-timer-header-main {
        gap: 10px;
    }

    .dynamic-timer-header-actions {
        gap: 6px;
    }

    .dynamic-timer-logo {
        width: 92px;
        height: 50px;
        padding: 6px 8px;
        border-radius: 12px;
    }

    .dynamic-timer-title {
        font-size: 13px;
    }

    .dynamic-timer-subtitle {
        margin-top: 2px;
        font-size: 11px;
    }

    .timer-remove-btn,
    .timer-end-btn {
        width: 30px;
        min-width: 30px;
        height: 30px;
    }

    .dynamic-timer-grid-large {
        grid-template-columns: minmax(0, 1fr) 122px 82px;
        gap: 6px;
    }

    .dynamic-timer-card .form-select,
    .dynamic-timer-card .form-control,
    .timer-result-box-blue {
        min-height: 26px;
        height: 26px;
        font-size: 11px;
    }

    .timer-result-box-blue {
        padding: 2px 8px;
    }
}

/* ===== Timer Responsive ===== */

@media (max-width: 1200px) {
    .dynamic-timers-container {
        grid-template-columns: repeat(4, minmax(340px, 1fr));
    }

    .dynamic-timer-header {
        gap: 10px;
        margin-bottom: 10px;
    }

    .dynamic-timer-header-main {
        gap: 10px;
    }

    .timer-remove-btn {
        align-self: flex-end;
    }

    .dynamic-timer-header-actions {
        align-self: flex-end;
    }

    .dynamic-timer-logo {
        width: 92px;
        height: 50px;
        padding: 6px 8px;
        border-radius: 12px;
    }

    .dynamic-timer-grid-large {
        grid-template-columns: minmax(0, 1fr) 122px 82px;
        gap: 6px;
    }

    .dynamic-timer-card {
        padding: 14px 14px 12px;
        border-radius: 18px;
    }

    .dynamic-timer-title {
        font-size: 13px;
    }

    .dynamic-timer-subtitle {
        margin-top: 2px;
        font-size: 11px;
    }

    .timer-remove-btn,
    .timer-end-btn {
        width: 30px;
        min-width: 30px;
        height: 30px;
    }

    .dynamic-timer-card .form-select,
    .dynamic-timer-card .form-control,
    .timer-result-box-blue {
        min-height: 26px;
        height: 26px;
        font-size: 11px;
    }

    .timer-result-box-blue {
        padding: 2px 8px;
    }

    .project-picker-panel {
        right: -24px;
        left: -24px;
    }

    .project-picker-table th:nth-child(2),
    .project-picker-table td:nth-child(2) {
        width: 140px;
    }
}

@media (max-width: 768px) {
    .dynamic-timers-container {
        grid-template-columns: 1fr;
    }

    .dynamic-timer-card {
        padding: 14px;
    }

    .dynamic-timer-logo {
        width: 120px;
        height: 64px;
    }

    .dynamic-timer-grid-large {
        grid-template-columns: 1fr;
    }

    .project-picker-panel {
        position: static;
        margin-top: 8px;
    }
}
