/* filepath: styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #041b24;
    min-height: 100vh;
    color: #f8fdff;
    padding: 20px;
}

.container {
    max-width: 940px;
    margin: 0 auto;
}

header {
    text-align: center;
    padding: 28px 0 18px;
    margin-bottom: 12px;
}

header h1 {
    font-size: 2.6rem;
    color: #ffd166;
    text-shadow: 0 3px 0 #01313f;
    margin-bottom: 10px;
}

.subtitle {
    color: #d8fbff;
    font-size: 1.08rem;
}

.control-row {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.controls-left {
    justify-content: flex-start;
}

.controls-right {
    justify-content: flex-end;
    margin-left: auto;
}

.input-group {
    display: grid;
    gap: 5px;
}

.input-group label {
    color: #ffd166;
    font-size: 0.82rem;
    font-weight: 600;
}

.input-group input {
    width: 150px;
    padding: 8px 10px;
    border-radius: 7px;
    border: 2px solid #2dd4bf;
    background: #061f2a;
    color: #ffffff;
    font-size: 0.92rem;
}

#timeInput {
    width: 112px;
}

.input-group input:focus {
    outline: none;
    border-color: #ffd166;
    box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.35);
}

#calculateBtn,
#nowBtn,
#monthlyTableBtn,
#closeMonthModal {
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 700;
}

#calculateBtn {
    min-width: 104px;
    padding: 9px 13px;
    background: #0ea5a4;
    color: #f8fdff;
    font-size: 0.94rem;
    box-shadow: 0 6px 0 #063f52;
}

#calculateBtn:hover,
#nowBtn:hover,
#monthlyTableBtn:hover,
#closeMonthModal:hover {
    filter: brightness(1.12);
}

.result-section {
    background: #082c39;
    border-radius: 16px;
    padding: 24px;
    border: 2px solid #0ea5a4;
    display: none;
    box-shadow: 0 18px 0 #02131a;
}

.result-section.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 18px;
    text-align: center;
}

.result-section h2 {
    color: #ffffff;
    font-size: 1.45rem;
}

#monthlyTableBtn {
    padding: 9px 13px;
    background: #063f52;
    border: 2px solid #0ea5a4;
    color: #f8fdff;
    font-size: 0.92rem;
    box-shadow: 0 6px 0 #02131a;
}

#nowBtn {
    width: 100%;
    padding: 9px 13px;
    background: #0b5266;
    border: 2px solid #2dd4bf;
    color: #f8fdff;
    font-size: 0.92rem;
    box-shadow: 0 6px 0 #02131a;
}

.tide-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-bottom: 22px;
}

.tide-controls,
.tide-actions {
    display: flex;
    flex: 0 0 150px;
    flex-direction: column;
    gap: 12px;
}

.tide-controls .input-group,
.tide-actions #calculateBtn,
.tide-actions #monthlyTableBtn {
    flex: 0 0 auto;
}

.tide-controls .input-group input,
.tide-controls #timeInput,
.tide-actions button {
    width: 100%;
}

.tide-display {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 24px;
    aspect-ratio: 1 / 1;
    max-width: 420px;
    width: min(100%, 420px);
    padding: 30px;
    background: #063f52;
    border: 3px solid #ffd166;
    border-radius: 14px;
    margin: 0;
    box-shadow: 10px 10px 0 #02131a;
}

.tide-height {
    text-align: center;
}

.tide-height .label {
    display: block;
    color: #ffffff;
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.tide-value-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 12px;
}

.tide-height .value {
    font-size: 6rem;
    font-weight: 800;
    color: #36f1cd;
    line-height: 1;
    text-shadow: 0 4px 0 #011e27;
}

.status-arrow {
    font-size: 3.4rem;
    font-weight: 800;
    line-height: 1;
}

.next-tide-countdown {
    display: block;
    margin-top: 14px;
    color: #ffffff;
    font-size: 1.08rem;
    font-weight: 400;
    letter-spacing: 0;
}

.status-rising {
    color: #a7f3d0;
}

.status-falling {
    color: #ff8fab;
}

.status-high {
    color: #ffd166;
}

.status-low {
    color: #38bdf8;
}

.tide-chart {
    margin-bottom: 22px;
    background: #061f2a;
    border: 2px solid #0ea5a4;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 8px 0 #02131a;
}

.tide-chart canvas {
    width: 100%;
    height: 200px;
}

.tide-times {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.time-card {
    background: #061f2a;
    border: 2px solid #0ea5a4;
    border-radius: 12px;
    padding: 18px;
    text-align: center;
    box-shadow: 0 8px 0 #02131a;
}

.time-card h3 {
    color: #ffd166;
    font-size: 0.92rem;
    margin-bottom: 10px;
}

.time-card p {
    color: #36f1cd;
    font-size: 1.18rem;
    font-weight: 700;
}

.modal-backdrop {
    align-items: center;
    background: rgba(2, 13, 18, 0.82);
    display: none;
    inset: 0;
    justify-content: center;
    padding: 20px;
    position: fixed;
    z-index: 10;
}

.modal-backdrop.show {
    display: flex;
}

.modal-panel {
    background: #082c39;
    border: 2px solid #0ea5a4;
    border-radius: 14px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.38);
    max-height: 86vh;
    max-width: 850px;
    overflow: hidden;
    width: 100%;
}

.modal-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 18px 20px;
    border-bottom: 2px solid #0ea5a4;
}

.modal-header h2 {
    color: #ffffff;
    font-size: 1.25rem;
}

#closeMonthModal {
    background: #ef476f;
    color: #ffffff;
    height: 36px;
    width: 36px;
}

.tide-table {
    max-height: calc(86vh - 74px);
    overflow: auto;
    padding: 18px;
}

.tide-table table {
    width: 100%;
    border-collapse: collapse;
}

.tide-table th,
.tide-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #0e5263;
}

.tide-table th {
    color: #ffd166;
    font-weight: 700;
}

.tide-table td {
    color: #f8fdff;
}

.tide-table tr:hover {
    background: #0b3a4b;
}

footer {
    text-align: center;
    padding: 20px;
    color: #d8fbff;
    font-size: 0.9rem;
}

@media (max-width: 700px) {
    body {
        padding: 14px;
    }

    header h1 {
        font-size: 1.9rem;
    }

    .control-row {
        align-items: stretch;
    }

    .controls-left,
    .controls-right {
        width: 100%;
    }

    .controls-right {
        margin-left: 0;
    }

    .input-group input,
    #timeInput {
        width: 100%;
    }

    .input-group {
        flex: 1 1 130px;
    }

    #calculateBtn {
        flex: 1 1 0;
    }

    #monthlyTableBtn {
        flex: 1 1 0;
    }

    .tide-layout {
        flex-direction: column;
        align-items: stretch;
    }

    .tide-controls,
    .tide-actions {
        flex: 0 1 auto;
        width: 100%;
    }

    .tide-display {
        gap: 20px;
        padding: 22px;
        max-width: 360px;
        width: min(100%, 360px);
        margin: 0 auto;
    }

    .tide-height .value {
        font-size: 4.4rem;
    }

    .status-arrow {
        font-size: 2.6rem;
    }

    .next-tide-countdown {
        font-size: 0.98rem;
    }

    .tide-times {
        grid-template-columns: 1fr;
    }
}
