:root {
    --primary: #2E7D32;
    --primary-dark: #1B5E20;
    --primary-light: #4CAF50;
    --secondary: #0288D1;
    --background: #F4F7F6;
    --card-bg: #FFFFFF;
    --text-main: #1F2937;
    --text-light: #6B7280;
    --border: #E5E7EB;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 14px;
    --transition: all 0.25s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

img {
    max-width: 100%;
}

.hidden {
    display: none !important;
}

.active-screen {
    display: block;
}

/* ================= HEADER ================= */
header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    text-align: center;
    padding: 1.4rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ================= TABS ================= */
.tabs {
    display: flex;
    background: white;
    position: sticky;
    top: 76px;
    z-index: 99;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-light);
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    background: rgba(46,125,50,0.08);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 3px solid var(--primary);
    background: rgba(46,125,50,0.06);
}

/* ================= MAIN ================= */
main {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

/* ================= CARDS ================= */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.4rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.03);
}

h2 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.35rem;
    border-bottom: 2px solid rgba(76,175,80,0.3);
    padding-bottom: 0.5rem;
}

h3 {
    color: var(--text-main);
    margin-bottom: 1rem;
}

/* ================= FORMS ================= */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.95rem;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    background: white;
    transition: var(--transition);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(76,175,80,0.15);
}

/* ================= BUTTONS ================= */
button {
    border: none;
    border-radius: 12px;
    padding: 0.95rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#logForm button,
#refreshLogsBtn {
    background: var(--primary);
    color: white;
}

#logForm button:hover,
#refreshLogsBtn:hover {
    background: var(--primary-dark);
}

#shareLogsBtn {
    background: var(--secondary) !important;
    color: white;
}

#shareLogsBtn:hover {
    filter: brightness(0.92);
}

/* ================= MESSAGE ================= */
#submitMessage {
    margin-top: 1rem;
    text-align: center;
    font-weight: 600;
    color: var(--primary);
}

/* ================= WEATHER ================= */
#weatherData {
    overflow-x: auto;
}

#weatherData::-webkit-scrollbar {
    height: 6px;
}

#weatherData::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 20px;
}

/* ================= TABLE ================= */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 20px;
}

#historyTable {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
    background: white;
}

#historyTable th {
    background: var(--primary);
    color: white;
    text-align: left;
    padding: 1rem 0.8rem;
    font-size: 0.95rem;
    position: sticky;
    top: 0;
}

#historyTable td {
    padding: 0.85rem 0.8rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

#historyTable tbody tr:nth-child(even) {
    background: rgba(0,0,0,0.02);
}

#historyTable tbody tr:hover {
    background: rgba(76,175,80,0.08);
}

/* ================= FILTERS ================= */
#historyScreen .card > div {
    width: 100%;
}

/* ================= TABLET ================= */
@media (max-width: 1024px) {
    main {
        padding: 0.9rem;
    }

    .card {
        padding: 1.2rem;
    }
}

/* ================= MOBILE ================= */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.3rem;
    }

    .tabs {
        top: 72px;
    }

    .tab-btn {
        font-size: 0.95rem;
        padding: 0.9rem 0.5rem;
    }

    .card {
        padding: 1rem;
        border-radius: 12px;
    }

    h2 {
        font-size: 1.2rem;
    }

    input,
    select,
    textarea,
    button {
        font-size: 0.95rem;
    }

    #historyTable {
        min-width: 650px;
    }
}

/* ================= SMALL MOBILE ================= */
@media (max-width: 480px) {
    main {
        padding: 0.7rem;
    }

    header {
        padding: 1rem 0.8rem;
    }

    header h1 {
        font-size: 1.15rem;
    }

    .tab-btn {
        font-size: 0.85rem;
        padding: 0.8rem 0.35rem;
    }

    .card {
        padding: 0.9rem;
    }

    input,
    select,
    textarea {
        padding: 0.8rem;
    }

    button {
        padding: 0.9rem;
    }
}

/* ================= LARGE SCREENS ================= */
@media (min-width: 1400px) {
    main {
        max-width: 1280px;
    }
}
