/* --- Global Reset & Typography --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: #f4f6f9; /* Lys gråblå bakgrunn for hele siden */
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s;
}

/* --- Layout Utilities --- */
.container, 
.dashboard-container,
section {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Sørg for at footer havner i bunn */
main {
    flex: 1;
}

/* --- Navigation (Header) --- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: #000000;
    color: #cccccc;
    border-bottom: 1px solid #1a1a1a;
}

.logo a {
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: 20px;
}

.main-nav a {
    text-decoration: none;
    color: #ccc;
    font-weight: 500;
}

.main-nav a:hover,
.logo a:hover {
    color: #facc15; /* Gul highlight */
    opacity: 1;
}

.top-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    border: 1px solid #4747fa;
    background: #4747fa;
    color: #fff;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #3b3be0;
    border-color: #3b3be0;
    color: #fff;
    transform: translateY(-1px);
}

.btn.secondary {
    background: white;
    color: #4747fa;
    border: 1px solid #4747fa;
}

.btn.secondary:hover {
    background: #f0f0ff;
}

.btn.small {
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
}

.btn.disabled,
.btn[aria-disabled="true"] {
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(100%);
}

/* --- Card Box (Standard hvit boks for dashboard/stall/analyse) --- */
.card-box {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    margin-bottom: 20px;
}

.card-box h1, .card-box h2, .card-box h3, .card-box h4 {
    margin-top: 0;
    color: #222;
}

/* --- Tables --- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th {
    text-align: left;
    padding: 10px;
    background: #f9fafb;
    border-bottom: 2px solid #eee;
    color: #666;
    font-weight: 600;
}

.table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

/* --- Alerts --- */
.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.alert-info {
    background: #e0f2fe;
    color: #0c4a6e;
    border: 1px solid #bae6fd;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ---------------------------------------------------------
   LANDING PAGE STYLES (Index.php)
   --------------------------------------------------------- */

/* Hero Section */
.hero {
    background: white;
    border-radius: 12px;
    margin-top: 30px;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.hero h1 {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #111;
}

.hero-media img {
    width: 100%;
    max-width: 400px;
    border-radius: 20px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Product & Beta Sections */
.alt {
    background-color: #e9ecef; /* Lys grå bakgrunn for annenhver seksjon */
    border-radius: 12px;
}

.beta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.download-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #ddd;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Product Layout (Tekst + Bilde) */
.product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    background: white;
    padding: 40px;
    border-radius: 12px;
    border: 1px solid #eee;
}

.product-image-wrapper {
    text-align: center;
}

.product-image {
    max-width: 100%;
    max-height: 350px;
    border-radius: 12px;
}

/* Screenshots Grid */
.screens-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.screen-shot img {
    width: 100%;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* Responsivitet for Landing Page */
@media (max-width: 900px) {
    .hero-grid, .product-layout, .screens-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .hero-buttons {
        justify-content: center;
        display: flex; 
        flex-wrap: wrap; 
        gap: 10px;
    }
    .hero-media { margin-top: 30px; }
    .product-image-wrapper { order: -1; /* Bilde før tekst på mobil */ }
}


/* ---------------------------------------------------------
   DASHBOARD / TRAINER / ANALYSE STYLES
   --------------------------------------------------------- */

/* Master Detail Grid (Dashboard) */
.master-detail { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 20px; 
}

@media (min-width: 900px) {
    .master-detail { 
        grid-template-columns: 350px 1fr; 
        height: calc(100vh - 150px); 
        min-height: 600px; 
    }
    .trip-list-panel { 
        overflow-y: auto; 
        height: 100%; 
        display:flex; 
        flex-direction:column;
    }
    .trip-detail-panel { 
        overflow-y: auto; 
        height: 100%; 
        display: flex; 
        flex-direction: column; 
        gap: 20px; 
    }
}

/* Horse Cards (Toppen av dashboard) */
.horses-section { 
    display: flex; 
    gap: 15px; 
    overflow-x: auto; 
    padding-bottom: 10px; 
}

.horse-card {
    flex: 0 0 140px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s, box-shadow 0.1s;
}

.horse-card:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
}

.horse-card.active { 
    border: 2px solid #4747fa; 
    background: #f0f0ff; 
}

.horse-img { 
    width: 100%; 
    height: 100px; 
    object-fit: cover; 
    background: #eee; 
}

.horse-info { padding: 8px; }
.horse-name { font-weight: bold; font-size: 0.9rem; margin-bottom: 2px; }
.horse-age { font-size: 0.75rem; color: #666; }

.add-horse-card {
    flex: 0 0 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    color: #666;
}

/* Edit Button on Horse Card */
.edit-horse-btn {
    position: absolute; top: 5px; right: 5px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 12px; z-index: 10;
    color: #333;
}
.edit-horse-btn:hover { color: #4747fa; background: white; }

/* Map & Trip Items */
#trip-map { 
    width: 100%; 
    height: 350px; 
    background: #eee; 
    border-radius: 8px; 
}

tr.trip-row:hover { background: #f0f7ff; cursor: pointer; }
tr.trip-row.checked-row { background-color: #fff8e1; border-left: 3px solid #f0ad4e; }

.hidden { display: none !important; }

/* ---------------------------------------------------------
   FOOTER STYLES (Oppdatert)
   --------------------------------------------------------- */
.tt-footer {
    background-color: #111;
    color: #ccc;
    padding: 25px 0 20px; /* Kompakt høyde */
    border-top: 1px solid #222;
    margin-top: auto; /* Dytter footer ned til bunn */
    font-size: 0.85rem;
}

.tt-footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr; /* Venstre kolonne litt bredere */
    gap: 40px;
    align-items: start;
}

/* Kolonne 1: Brand */
.tt-col-brand .tt-footer-logo img {
    display: block;
    margin-bottom: 10px;
}
.tt-tagline {
    margin-bottom: 10px;
    color: #888;
    line-height: 1.3;
}
.tt-contact a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
}
.tt-copyright {
    margin-top: 15px;
    font-size: 0.75rem;
    color: #555;
}

/* Kolonne 2 & 3: Overskrifter */
.tt-col-links h5, .tt-col-app h5 {
    color: #fff;
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    font-weight: 600;
}

/* Linker */
.tt-col-links nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tt-col-links a {
    color: #aaa;
    text-decoration: none;
    transition: color 0.2s;
}
.tt-col-links a:hover {
    color: #facc15;
}

/* App Knapper */
.tt-app-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.btn-app {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    transition: transform 0.1s, opacity 0.2s;
    
    /* Felles stil for begge knappene: Hvit bakgrunn, svart tekst */
    background-color: #fff;
    color: #000;
    border: 1px solid #fff;
}
.btn-app:hover {
    transform: translateY(-1px);
    opacity: 0.9;
    background-color: #f0f0f0;
    border-color: #f0f0f0;
}

/* Responsivitet for Footer */
@media (max-width: 768px) {
    .tt-footer-grid {
        grid-template-columns: 1fr; /* En kolonne på mobil */
        gap: 25px;
        text-align: center;
    }
    .tt-col-brand .tt-footer-logo img,
    .tt-contact {
        margin: 0 auto 10px auto;
    }
    .tt-app-buttons {
        max-width: 250px;
        margin: 0 auto;
    }
}

/* --- Modals (Popups) --- */
.modal {
    display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5); align-items: center; justify-content: center;
}
.modal.show { display: flex; }
.modal-content {
    background: #fff; padding: 30px; border-radius: 12px; width: 90%; max-width: 450px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* --- Auth Forms (Login/Register) --- */
.auth-forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.auth-form {
    background: white;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.auth-form input, .auth-form select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
}