/* =========================================================
   TIME BROWSER
   Main stylesheet
   ========================================================= */


/* ---------- Reset ---------- */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
}


body {
    min-height: 100vh;

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: #f4f4f5;
    color: #18181b;

    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}


/* ---------- App ---------- */

.app {
    width: 100%;
    max-width: 1200px;

    margin: 0 auto;

    padding:
        30px
        24px
        50px;
}


/* ---------- Header ---------- */

.header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    margin-bottom: 50px;
}


.brand {
    display: flex;

    align-items: center;
    gap: 12px;
}


.brand-icon {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    border: 2px solid currentColor;
    border-radius: 50%;

    font-size: 21px;
}


.brand h1 {
    font-size: 18px;
    font-weight: 700;

    letter-spacing: 0.18em;
}


.theme-toggle {
    width: 42px;
    height: 42px;

    border: 1px solid #d4d4d8;
    border-radius: 50%;

    background: transparent;
    color: inherit;

    cursor: pointer;

    font-size: 19px;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}


.theme-toggle:hover {
    background: #e4e4e7;
    transform: rotate(15deg);
}

/* Wadah untuk menumpuk judul dan author secara vertikal */
.brand-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px; /* Jarak antara TIME BROWSER dan by me-kawa */
}

/* Styling untuk teks author agar lebih kecil */
.author-subtitle {
    font-size: 11px;       /* Ukuran font lebih kecil */
    font-weight: 500;      /* Ketebalan font */
    letter-spacing: 0.1em; /* Mengatur jarak spasi agar tidak terlalu renggang */
    opacity: 0.7;          /* Memberikan efek sedikit pudar agar elegan (opsional) */
}

/* ---------- Search ---------- */

.search-section {
    position: relative;

    width: 100%;
    max-width: 650px;

    margin: 0 auto 70px;
}


.search-label {
    display: block;

    margin-bottom: 10px;

    font-size: 13px;
    font-weight: 600;

    color: #71717a;
}


.search-box {
    position: relative;

    display: flex;
    align-items: center;

    width: 100%;
}


.search-icon {
    position: absolute;
    left: 18px;

    font-size: 24px;

    color: #71717a;

    pointer-events: none;
}


.search-box input {
    width: 100%;

    padding:
        16px
        48px
        16px;

    border: 1px solid #d4d4d8;
    border-radius: 14px;

    outline: none;

    background: #ffffff;
    color: #18181b;

    font-size: 16px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


.search-box input:focus {
    border-color: #71717a;

    box-shadow:
        0 0 0 3px rgba(113, 113, 122, 0.12);
}


.clear-search {
    position: absolute;

    right: 14px;

    width: 28px;
    height: 28px;

    border: none;
    border-radius: 50%;

    background: #e4e4e7;
    color: #52525b;

    cursor: pointer;

    font-size: 18px;
}


.search-results {
    position: absolute;

    z-index: 20;

    top: 76px;
    left: 0;
    right: 0;

    overflow: hidden;

    border: 1px solid #e4e4e7;
    border-radius: 14px;

    background: #ffffff;

    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.12);
}


.search-result {
    display: flex;

    align-items: center;
    justify-content: space-between;

    width: 100%;

    padding: 15px 18px;

    border: none;
    border-bottom: 1px solid #f4f4f5;

    background: transparent;

    color: inherit;

    text-align: left;

    cursor: pointer;
}


.search-result:last-child {
    border-bottom: none;
}


.search-result:hover 

/* ---------- Search Result Information ---------- */

.result-information {
    flex: 1;

    cursor: pointer;

    min-width: 0;
}


/* ---------- Add Button ---------- */

.result-add-button {
    flex-shrink: 0;

    padding:
        7px
        13px;

    border: 1px solid #d4d4d8;
    border-radius: 8px;

    background: #ffffff;
    color: #18181b;

    cursor: pointer;

    font-size: 12px;
    font-weight: 600;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}


/* ---------- Added Button ---------- */

.result-add-button.added {
    background: #f4f4f5;

    color: #71717a;

    border-color: #e4e4e7;

    cursor: default;

    opacity: 0.9;
}


.result-add-button.added:hover {
    background: #f4f4f5;

    border-color: #e4e4e7;
}


/* ---------- Dark Mode ---------- */

body.dark .result-add-button.added {
    background: #27272a;

    color: #a1a1aa;

    border-color: #3f3f46;
}


body.dark .result-add-button.added:hover {
    background: #27272a;

    border-color: #3f3f46;
}


.result-city {
    font-weight: 600;
}


.result-region {
    margin-top: 3px;

    font-size: 12px;

    color: #71717a;
}


.result-timezone {
    font-size: 11px;

    color: #a1a1aa;
}


/* ---------- Main Clock ---------- */

.main-clock {
    text-align: center;

    margin-bottom: 80px;
}


.location-info {
    margin-bottom: 20px;
}


.location-info h2 {
    font-size: clamp(28px, 5vw, 48px);

    font-weight: 700;

    letter-spacing: 0.04em;
}


.location-info p {
    margin-top: 5px;

    color: #71717a;

    font-size: 14px;
}


.main-time {
    font-size: clamp(55px, 11vw, 120px);

    font-weight: 300;

    line-height: 1;

    letter-spacing: -0.04em;

    font-variant-numeric: tabular-nums;
}


.main-date {
    margin-top: 25px;

    font-size: 16px;

    color: #52525b;
}


.main-timezone {
    display: inline-block;

    margin-top: 12px;

    padding:
        6px
        12px;

    border-radius: 20px;

    background: #e4e4e7;

    font-size: 12px;
    font-weight: 600;

    letter-spacing: 0.05em;
}


/* ---------- Locations ---------- */

.locations-section {
    width: 100%;
}


.section-heading {
    display: flex;

    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
}


.section-heading h3 {
    font-size: 18px;
}


/* ---------- Clock Grid ---------- */

.clock-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;
}


.clock-card {
    position: relative;

    min-height: 150px;

    padding: 20px;

    border: 1px solid #e4e4e7;
    border-radius: 16px;

    background: #ffffff;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}


.clock-card:hover {
    transform: translateY(-3px);

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.08);
}


.clock-card.active {
    border-color: #71717a;

    box-shadow:
        0 0 0 2px rgba(113, 113, 122, 0.12);
}


.card-city {
    font-size: 14px;

    font-weight: 700;

    letter-spacing: 0.04em;
}


.card-region {
    margin-top: 4px;

    color: #71717a;

    font-size: 11px;
}


.card-time {
    margin-top: 25px;

    font-size: 28px;

    font-weight: 400;

    font-variant-numeric: tabular-nums;
}


.card-offset {
    margin-top: 5px;

    color: #71717a;

    font-size: 11px;
}


.remove-clock {
    position: absolute;

    top: 10px;
    right: 10px;

    width: 25px;
    height: 25px;

    border: none;
    border-radius: 50%;

    background: transparent;

    color: #a1a1aa;

    cursor: pointer;

    opacity: 0;

    transition:
        opacity 0.2s ease,
        background-color 0.2s ease;
}


.clock-card:hover .remove-clock {
    opacity: 1;
}


.remove-clock:hover {
    background: #f4f4f5;
    color: #18181b;
}


/* ---------- Empty State ---------- */

.empty-state {
    padding: 60px 20px;

    text-align: center;

    color: #71717a;
}


.empty-icon {
    margin-bottom: 15px;

    font-size: 40px;
}


.empty-state h3 {
    margin-bottom: 8px;

    color: #18181b;
}


.empty-state p {
    font-size: 14px;
}


/* ---------- Footer ---------- */

.footer {
    margin-top: 80px;

    padding-top: 25px;

    border-top: 1px solid #e4e4e7;

    text-align: center;

    color: #a1a1aa;

    font-size: 11px;

    line-height: 1.8;
}


/* ---------- Utility ---------- */

.hidden {
    display: none !important;
}


/* =========================================================
   DARK MODE
   ========================================================= */

body.dark {
    background: #09090b;
    color: #fafafa;
}


body.dark .search-box input {
    background: #18181b;
    color: #fafafa;

    border-color: #3f3f46;
}


body.dark .search-box input:focus {
    border-color: #71717a;
}


body.dark .search-results {
    background: #18181b;
    border-color: #3f3f46;
}


body.dark .search-result {
    border-color: #27272a;
}


body.dark .search-result:hover {
    background: #27272a;
}


body.dark .clock-card {
    background: #18181b;
    border-color: #27272a;
}


body.dark .clock-card:hover {
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.4);
}


body.dark .clock-card.active {
    border-color: #71717a;
}


body.dark .main-timezone {
    background: #27272a;
}


body.dark .theme-toggle {
    border-color: #3f3f46;
}


body.dark .theme-toggle:hover {
    background: #27272a;
}


body.dark .footer {
    border-color: #27272a;
}


body.dark .empty-state h3 {
    color: #fafafa;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    .clock-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    .app {
        padding:
            20px
            16px
            40px;
    }


    .header {
        margin-bottom: 35px;
    }


    .brand h1 {
        font-size: 15px;
    }


    .brand-icon {
        width: 34px;
        height: 34px;

        font-size: 18px;
    }


    .search-section {
        margin-bottom: 55px;
    }


    .main-clock {
        margin-bottom: 60px;
    }


    .main-time {
        font-size: 58px;
    }


    .main-date {
        font-size: 14px;
    }


    .section-heading {
        align-items: flex-start;
        gap: 12px;
    }


    .clock-grid {
        grid-template-columns: 1fr;
    }


    .clock-card {
        min-height: 135px;
    }


    .remove-clock {
        opacity: 1;
    }

}

/* =========================================================
   V2 - BACKGROUND SYSTEM
   ========================================================= */


/* ---------- Background Layer ---------- */

.background-layer {
    position: fixed;

    inset: 0;

    z-index: -1;

    overflow: hidden;

    background:
        linear-gradient(
            135deg,
            #f4f4f5,
            #e4e4e7
        );
}


.background-image {
    position: absolute;

    inset: 0;

    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;

    opacity: 0;

    transition:
        opacity 0.6s ease;

    transform: scale(1.02);
}


.background-image.visible {
    opacity: 1;
}


.background-video {
    position: absolute;

    top: 50%;
    left: 50%;

    width: 100vw;
    height: 56.25vw;

    min-width: 177.78vh;
    min-height: 100vh;

    transform:
        translate(-50%, -50%)
        scale(1.05);

    border: none;

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.6s ease;
}


.background-video.visible {
    opacity: 1;
}


.background-overlay {
    position: absolute;

    inset: 0;

    background:
        rgba(255, 255, 255, 0.72);

    backdrop-filter:
        blur(1px);
}


/* ---------- Header Actions ---------- */

.header-actions {
    display: flex;

    align-items: center;

    gap: 8px;
}


.header-button {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    border: 1px solid #d4d4d8;
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.8);

    color: inherit;

    cursor: pointer;

    font-size: 17px;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}


.header-button:hover {
    background: #ffffff;

    transform: rotate(20deg);
}


/* =========================================================
   Background Modal
   ========================================================= */

.modal {
    position: fixed;

    inset: 0;

    z-index: 100;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;
}


.modal.hidden {
    display: none;
}


.modal-backdrop {
    position: absolute;

    inset: 0;

    background:
        rgba(0, 0, 0, 0.45);

    backdrop-filter:
        blur(6px);
}


.background-modal {
    position: relative;

    z-index: 1;

    width: 100%;
    max-width: 600px;

    max-height: 90vh;

    overflow-y: auto;

    border: 1px solid #e4e4e7;
    border-radius: 20px;

    background: #ffffff;

    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.25);
}


/* ---------- Modal Header ---------- */

.modal-header {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    padding:
        22px 24px;

    border-bottom: 1px solid #e4e4e7;
}


.modal-header h2 {
    font-size: 20px;

    font-weight: 700;
}


.modal-header p {
    margin-top: 4px;

    color: #71717a;

    font-size: 12px;
}


.modal-close {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    border: none;
    border-radius: 50%;

    background: #f4f4f5;

    color: #52525b;

    cursor: pointer;

    font-size: 21px;
}


.modal-close:hover {
    background: #e4e4e7;
}


/* ---------- Form ---------- */

.background-form {
    padding: 24px;
}


.form-label {
    display: block;

    margin-bottom: 9px;

    font-size: 12px;

    font-weight: 600;

    color: #52525b;
}


.source-options {
    display: flex;

    gap: 10px;

    margin-bottom: 22px;
}


.source-option {
    display: flex;

    align-items: center;

    gap: 7px;

    padding:
        9px 13px;

    border: 1px solid #d4d4d8;
    border-radius: 9px;

    cursor: pointer;

    font-size: 12px;
}


.source-option:has(
    input:checked
) {
    border-color: #71717a;

    background: #f4f4f5;
}


.source-option input {
    margin: 0;
}


.background-url {
    width: 100%;

    padding:
        13px 14px;

    border: 1px solid #d4d4d8;
    border-radius: 10px;

    outline: none;

    background: #ffffff;
    color: #18181b;

    font-size: 13px;
}


.background-url:focus {
    border-color: #71717a;

    box-shadow:
        0 0 0 3px
        rgba(113, 113, 122, 0.12);
}


.form-help {
    margin-top: 7px;
    margin-bottom: 20px;

    color: #a1a1aa;

    font-size: 11px;

    line-height: 1.5;
}


/* ---------- Preview ---------- */

.background-preview {
    position: relative;

    display: flex;

    align-items: center;
    justify-content: center;

    width: 100%;

    aspect-ratio: 16 / 9;

    overflow: hidden;

    border: 1px solid #e4e4e7;
    border-radius: 12px;

    background: #f4f4f5;
}


.background-preview img,
.background-preview iframe {
    width: 100%;
    height: 100%;

    border: none;

    object-fit: cover;
}


.preview-placeholder,
.preview-error {
    padding: 20px;

    text-align: center;

    color: #a1a1aa;

    font-size: 12px;
}


.preview-error {
    color: #71717a;
}


/* ---------- Modal Actions ---------- */

.modal-actions {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-top: 22px;
}


.modal-actions-right {
    display: flex;

    gap: 8px;
}


.primary-button,
.secondary-button {
    padding:
        10px 15px;

    border-radius: 9px;

    cursor: pointer;

    font-size: 12px;

    font-weight: 600;
}


.primary-button {
    border: 1px solid #18181b;

    background: #18181b;

    color: #ffffff;
}


.primary-button:hover {
    background: #27272a;
}


.secondary-button {
    border: 1px solid #d4d4d8;

    background: #ffffff;

    color: #18181b;
}


.secondary-button:hover {
    background: #f4f4f5;
}


/* =========================================================
   Dark Mode - Background
   ========================================================= */

body.dark .background-layer {
    background:
        linear-gradient(
            135deg,
            #09090b,
            #18181b
        );
}


body.dark .background-overlay {
    background:
        rgba(0, 0, 0, 0.62);
}


body.dark .header-button {
    background:
        rgba(24, 24, 27, 0.85);

    border-color: #3f3f46;
}


body.dark .header-button:hover {
    background: #27272a;
}


body.dark .background-modal {
    background: #18181b;

    border-color: #3f3f46;
}


body.dark .modal-header {
    border-color: #3f3f46;
}


body.dark .modal-close {
    background: #27272a;

    color: #a1a1aa;
}


body.dark .modal-close:hover {
    background: #3f3f46;
}


body.dark .form-label {
    color: #a1a1aa;
}


body.dark .source-option {
    border-color: #3f3f46;
}


body.dark .source-option:has(
    input:checked
) {
    background: #27272a;

    border-color: #71717a;
}


body.dark .background-url {
    background: #09090b;

    color: #fafafa;

    border-color: #3f3f46;
}


body.dark .background-preview {
    background: #09090b;

    border-color: #3f3f46;
}


body.dark .secondary-button {
    background: #18181b;

    color: #fafafa;

    border-color: #3f3f46;
}


body.dark .secondary-button:hover {
    background: #27272a;
}


body.dark .primary-button {
    background: #fafafa;

    color: #18181b;

    border-color: #fafafa;
}


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 600px) {

    .header-actions {
        gap: 5px;
    }


    .header-button,
    .theme-toggle {
        width: 36px;
        height: 36px;
    }


    .background-modal {
        max-height: 94vh;

        border-radius: 16px;
    }


    .modal-header {
        padding:
            18px 18px;
    }


    .background-form {
        padding: 18px;
    }


    .source-options {
        flex-direction: column;
    }


    .source-option {
        width: 100%;
    }


    .modal-actions {
        align-items: stretch;

        flex-direction: column;
    }


    .modal-actions-right {
        width: 100%;
    }


    .modal-actions-right button {
        flex: 1;
    }

}
