/* style.css (KORRASTATUD JA PARANDATUD VERSIOON) */

body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; color: #2e2e2e; background-color: #fcfcfc; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
header, footer { padding: 20px 0; text-align: left; }
.logo-image { max-height: 50px; }
.breadcrumbs { margin: 20px 0; font-size: 0.9em; color: #777; }
.breadcrumbs a { color: #e7c4a4; text-decoration: none; }

/* Styles for Category Page (card-grid) */
a {
  color: #e7c4a4;
  text-decoration: underline;
}

a:hover,
a:focus {
  text-decoration: none;
}

.breadcrumbs a {
  color: #e7c4a4;
  text-decoration: underline;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin-top: 30px;
}
.card-item {
    text-decoration: none;
    color: #333;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}
.card-item:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12) !important;
}
.card-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.card-item h3 {
    padding: 15px;
    margin: 0;
    font-size: 1.1em;
    text-align: center;
    background-color: white;
}


/* ========================================================== */
/* === ÜKSIKU KAARDI STIILID JA INTERAKTIIVNE EFEKT === */
/* ========================================================== */

/* 1. Peamine konteiner, mis loob valge kaardi ja 3D-ruumi */
.single-card-container {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 40px;
    margin: 40px auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    perspective: 1000px; /* Äärmiselt oluline 3D jaoks! */
}

/* 2. Kaardi sisu paigutus */
.card-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: center;
}

/* 3. Pildi konteinerile 3D-omaduste andmine */
.card-image {
    flex: 1; 
    min-width: 300px;
    transform-style: preserve-3d;
}

/* 4. Pildi baasolek ja sujuv üleminek */
.card-image img { 
    width: 100%; 
    border-radius: 8px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    /* See on baasolek (ilma hiireta) */
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateZ(0) rotateX(0) rotateY(0);
}

/* 5. INTERAKTIIVNE EFEKT */
.single-card-container:hover .card-image img {
    /* See rakendub, kui hiir on valge konteineri peal */
    transform: translateZ(20px) rotateX(4deg) rotateY(-6deg);
    box-shadow: 0 15px 40px rgba(0,0,0,0.25); 
}

/* 6. Ülejäänud detailide stiilid */
.card-details { flex: 1; min-width: 300px; }
.card-details h1 { font-size: 2.5em; margin-top: 0; }
.card-description { font-size: 1.1em; line-height: 1.6; margin-top: 20px; }
.cta-button {
    display: inline-block;
    background-color: #e7c4a4;
    color: white !important;
    padding: 15px 35px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1.2em;
    font-weight: bold;
    margin-top: 25px;
    text-align: center;
    transition: background-color 0.2s;
}
.cta-button:hover { background-color: #c2966c; }


/* ========================================================== */
/* === ÜLEJÄÄNUD STIILID (HEADER, FOOTER JNE) === */
/* ========================================================== */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #2c3e50;
    color: white;
    padding: 20px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    display: none;
    z-index: 9999;
}
.cookie-banner-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.cookie-banner-content {
    flex-grow: 1;
}
.cookie-banner-content p {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.5;
}
.cookie-banner-content a {
    color: #7aade2;
    text-decoration: underline;
    font-weight: bold;
}
.cookie-banner-actions button {
    background-color: #e7c4a4;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.2s;
    white-space: nowrap;
}
.cookie-banner-actions button:hover {
    background-color: #c2966c;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}
.search-form {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 50px;
    overflow: hidden;
}
.search-input {
    border: none;
    padding: 10px 15px;
    font-size: 1em;
    outline: none;
    background-color: transparent;
    width: 200px;
    transition: width 0.3s ease;
}
.search-input:focus {
    width: 250px;
}
.search-button {
    background-color: #e7c4a4;
    color: white;
    border: none;
    padding: 0 15px;
    cursor: pointer;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
}
.search-button:hover {
    background-color: #c2966c;
}

footer {
    text-align: center;
}
.page-header {
    padding: 10px 0;
}
.logo-image {
    max-height: 50px;
    display: block;
}

#form-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    font-weight: 500;
    display: none;
}
.status-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}
.status-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}
.submit-btn {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 5px;
    background-color: #e7c4a4;
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 20px;
}
.submit-btn:hover {
    background-color: #c2966c;
}
.secondary-btn {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    font-weight: 500;
    text-align: center;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    margin-bottom: 20px;
    background-color: #fff;
    color: #e7c4a4;
    border: 2px solid #e7c4a4;
}
.secondary-btn:hover {
    background-color: #e7c4a4;
    color: #fff;
}
.secondary-btn:disabled {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: #6c757d;
    cursor: not-allowed;
}
.flex-container input {
  min-width: 0;
}
input {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    font-weight: 500;
    text-align: center;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

/* ========================================================== */
/* === RESPONSIVE STIILID (@media reeglid) === */
/* ========================================================== */

@media (max-width: 768px) {
    .card-wrapper { 
        flex-direction: column; 
    }
    .single-card-container {
        padding: 20px;
        margin-top: 20px;
    }
    .single-card-container:hover .card-image img,
    .single-card-container .card-image img {
        transform: none;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
    
    .cookie-banner-wrapper {
        flex-direction: column;
        text-align: center;
    }

    .search-area {
        flex: 1 1 auto;
        min-width: 0;
        margin-top: 7px;
    }
    .search-input,
    .search-input:focus {
        width: 100%;
    }
    
    .header-container {
        flex-direction: row;
        gap: 15px;
    }

    .page-header .header-container {
        align-items: flex-start;
    }
    .page-header .search-area {
        width: 100%;
    }
}
.single-card-container .card-image img {
    transform-style: preserve-3d;
    transform: translateZ(0) rotateX(0) rotateY(0);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 
  See on VÕTI. Me kasutame !important, et see reegel 
  kirjutaks kõik teised "transform" reeglid jõuga üle. 
*/
.single-card-container:hover .card-image img {
    transform: translateZ(20px) rotateX(4deg) rotateY(-6deg) !important;
}

/* 
  Mobiilivaates keelame efekti samuti jõuga ära, et vältida vigu.
*/
@media (max-width: 768px) {
    .single-card-container:hover .card-image img,
    .single-card-container .card-image img {
        transform: none !important;
    }
}
/* === BREADCRUMB STYLES === */
.breadcrumb-nav {
    margin: 20px 0 30px 0;
    font-size: 0.9em;
}

.breadcrumb-nav ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.breadcrumb-nav li {
    display: inline;
}

/* See lisab ">" eraldaja CSS-i abil, hoides HTML-i puhtana */
.breadcrumb-nav li:not(:last-child)::after {
    content: '>';
    margin: 0 0.75em;
    color: #888;
    user-select: none; /* Ei lase eraldajat hiirega valida */
}

.breadcrumb-nav a {
    color: #c2966c; /* Sinu lingi värv */
    text-decoration: none;
}

.breadcrumb-nav a:hover {
    text-decoration: underline;
}

/* Praeguse lehe stiil (pole klikitav) */
.breadcrumb-nav li[aria-current="page"] {
    color: #2e2e2e; /* Tumedam tekst */
    font-weight: 500;
}

.facebook-share {
    background-color: #1877F2 !important; /* Ametlik Facebooki sinine */
    margin-left: 10px; /* Väike vahe download-nupuga */
}

.facebook-share:hover {
    background-color: #166fe5 !important;
}
/* Stiil lingi kopeerimise nupule */
.copy-button {
    background-color: #6c757d; /* Näiteks hall */
}
.copy-button:hover {
    background-color: #5a6268;
}
/* Muudame peamise konteineri flexboxiks, et nupud ritta saada */
.card-actions {
    display: flex;
    flex-wrap: wrap; /* Lubab nuppudel väiksemal ekraanil reavahet teha */
    align-items: center; /* Joondab nupud vertikaalselt keskele */
    gap: 15px; /* Lisab vahe peamise nupu ja väiksemate nuppude grupi vahele */
    margin-top: 20px; /* Lisab veidi ruumi kirjeldusest */
}

/* Väiksemate nuppude grupi stiil */
.secondary-actions {
    display: flex;
    gap: 10px; /* Vahe väiksemate nuppude endi vahel */
}

/* See on uus ja oluline klass väiksemate nuppude jaoks! */
.btn-small {
    padding: 8px 15px; /* Vähendame polsterdust */
    font-size: 0.9rem;  /* Muudame fondi suurust väiksemaks */
    font-weight: 500;
}

/* Stiliseerime ka väiksema Facebooki nupu */
.btn-small.facebook-share {
    /* Võime lisada ikooni ja eemaldada teksti, et see oleks veel kompaktsem */
    /* See on näide, kuidas kasutada FontAwesome ikooni, kui see on lehele lisatud */
    /* content: '\f09a'; */
    /* font-family: "Font Awesome 5 Brands"; */
    background-color: #1877F2;
    color: white;
}

.btn-small.copy-button {
    background-color: #6c757d;
    color: white;
}
.btn-small.copy-button:hover {
    background-color: #5a6268;
}
.card-image-wrapper {
    position: relative;
    overflow: hidden; /* Peidab kõik, mis konteinerist välja ulatub */
}

/* See on tume kiht, mis ilmub pildi peale, kui hiirega peale minna */
.card-actions-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Poolläbipaistev must taust */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0; /* Vaikimisi täiesti läbipaistev (peidetud) */
    transition: opacity 0.3s ease; /* Sujuv ilmumise animatsioon */
    z-index: 10;
}

/* Kui hiirega minna kaardi lingi peale, muutub ülekate nähtavaks */
.card-item:hover .card-actions-overlay {
    opacity: 1;
}

/* Konteiner, et nupud oleksid reas ja murduksid ilusti väiksemal ekraanil */
.secondary-actions {
    display: flex;
    flex-wrap: wrap; /* Lubab nuppudel minna uuele reale */
    gap: 10px; /* Vahe nuppude vahel */
    margin-top: 15px; /* Eraldab selle suurest "Download" nupust */
}

/* Pinteresti nupu spetsiifiline stiil */
.cta-button.pinterest-share {
    background-color: #E60023; /* Ametlik Pinteresti punane */
    color: white;
}

.cta-button.pinterest-share:hover {
    background-color: #BD081C; /* Tumedam punane hiirega peale minnes */
}
@media (max-width: 768px) {

    /* 1. Muudame nuppude konteineri paigutust, et kõik oleks ühel real */
    .card-actions {
        flex-direction: row;       /* Nupud on horisontaalselt reas */
        justify-content: space-between; /* Asetab "Download" nupu ja ikoonid teineteisest eemale */
        align-items: center;       /* Joondab nupud vertikaalselt keskele */
    }

    /* 2. Muudame ainult jagamisnupud ümmargusteks ikoonideks */
    .secondary-actions .cta-button {
        font-size: 0;  /* PEIDAB NUPU TEKSTI ÄRA! */
        padding: 0;    /* Eemaldame üleliigse polsterduse */
        width: 44px;   /* Fikseeritud laius */
        height: 44px;  /* Fikseeritud kõrgus (laiusega sama, et tuleks ring) */
        border-radius: 50%; /* Muudab nupu täiesti ümmarguseks */
        position: relative; /* Vajalik, et saaksime ikooni keskele positsioneerida */
    }

    /* 3. Lisame ikooni CSS-i abil iga nupu sisse */
    .secondary-actions .cta-button::before {
        font-family: "Font Awesome 5 Brands", "Font Awesome 5 Free"; /* Määrame ikoonifondi */
        font-weight: 900;         /* Kasutame paksu (solid) ikooni versiooni */
        font-size: 18px;          /* Ikooni suurus nupu sees */
        color: white;             /* Ikooni värv */
        position: absolute;       /* Positsioneerime ikooni täpselt nupu keskele */
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        line-height: 1;
    }

    /* 4. Määrame igale nupule õige ikooni */
    .secondary-actions .facebook-share::before {
        font-family: "Font Awesome 5 Brands";
        content: "\f39e"; /* Facebooki 'f' ikooni kood */
    }

    .secondary-actions .pinterest-share::before {
        font-family: "Font Awesome 5 Brands";
        content: "\f231"; /* Pinteresti 'P' ikooni kood */
    }
    
    .secondary-actions .copy-button::before {
        font-family: "Font Awesome 5 Free"; /* See ikoon ei ole "Brands" kollektsioonis */
        content: "\f0c5"; /* 'Copy' ikooni kood */
    }
}
.copy-button-wrapper {
    position: relative; /* See on ankur, mille suhtes teavitus positsioneeritakse */
    display: inline-block; /* Tagab, et konteiner võtab ainult nii palju ruumi kui vaja */
}

/* 2. Teavituse enda stiil (alguses peidetud) */
.copy-tooltip {
    position: absolute;       /* Positsioneeritakse .copy-button-wrapper'i suhtes */
    bottom: 100%;             /* Asetab teavituse täpselt nupu kohale */
    left: 50%;                /* Joondab horisontaalselt keskele */
    transform: translateX(-50%); /* Peenjoondus keskele */
    margin-bottom: 8px;       /* Väike vahe nupu ja teavituse vahel */

    background-color: #e7c4a4; /* Roheline värv sümboliseerib edu */
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    white-space: nowrap;      /* Hoiab teksti ühel real */

    /* Alguses on teavitus nähtamatu ja peidetud */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 100;
}

/* 3. Klass, mille lisame JavaScriptiga, et teavitus nähtavale tuua */
.copy-tooltip.show {
    opacity: 1;
    visibility: visible;
}

/* 4. Väike parandus mobiilivaate jaoks, et ikoon ja tekst ei kattuks */
@media (max-width: 768px) {
    .secondary-actions .copy-button .btn-text {
        display: none; /* Peidame arvutivaate teksti mobiilis */
    }
}