/* ============================================================
   EDACO Design System — main.css
   Core styles, header, footer, shared components
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --primary: #39B54A;
    --primary-dark: #2d9a3d;
    --primary-light: #e8f5ea;
    --accent: #E41C24;
    --white: #FFFFFF;
    --bg: #FFFFFF;
    --bg-alt: #f8f9fa;
    --bg-dark: #0d1117;
    --bg-dark-alt: #161b22;
    --text-dark: #1a1a1a;
    --text-medium: #4a4a4a;
    --text-light: #6b7280;
    --text-white: #FFFFFF;
    --border: #e5e7eb;
    --border-dark: #d1d5db;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --max-width: 1280px;
    --header-height: 70px;
    --nav-height: 50px;
    --section-padding: 80px 0;
    --transition: 0.25s ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-dark);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition);
}

ul, ol {
    list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-dark);
    letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }

p {
    color: var(--text-medium);
    line-height: 1.7;
}

/* --- Layout Utilities --- */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.section {
    padding: var(--section-padding);
}

.section--alt {
    background: var(--bg-alt);
}

.section--dark {
    background: var(--bg-dark);
    color: var(--text-white);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 {
    color: var(--text-white);
}

.section--dark p {
    color: rgba(255,255,255,0.7);
}

.section__header {
    text-align: center;
    margin-bottom: 48px;
}

.section__header h2 {
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section__header p {
    max-width: 600px;
    margin: 0 auto;
    font-size: 1.05rem;
}

.section__header::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--primary);
    margin: 16px auto 0;
}

.grid {
    display: grid;
    gap: 24px;
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all var(--transition);
}

.btn--primary {
    background: var(--primary);
    color: var(--white);
}

.btn--primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn--outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn--outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn--white {
    background: var(--white);
    color: var(--text-dark);
}

.btn--white:hover {
    background: var(--bg-alt);
}

.btn--accent {
    background: var(--accent);
    color: var(--white);
}

.btn--accent:hover {
    background: #c4171e;
}

.btn--sm {
    padding: 10px 20px;
    font-size: 0.8rem;
}

.btn--lg {
    padding: 16px 40px;
    font-size: 1rem;
}

/* --- Cards --- */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card__image {
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.card:hover .card__image img {
    transform: scale(1.05);
}

.card__body {
    padding: 24px;
}

.card__tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 8px;
}

.card__title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    line-height: 1.4;
}

.card__text {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 16px;
    line-height: 1.6;
}

.card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.card__link {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.card__link:hover {
    color: var(--primary-dark);
}

.card__link::after {
    content: '\2192';
    transition: transform var(--transition);
}

.card__link:hover::after {
    transform: translateX(4px);
}

.card__date {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* --- Forms --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 0;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-dark);
    background: var(--white);
    transition: border-color var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

/* --- Alerts --- */
.alert {
    padding: 14px 20px;
    font-size: 0.9rem;
    border-left: 4px solid;
    margin-bottom: 20px;
}

.alert--success {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.alert--error {
    background: #fef2f2;
    border-color: var(--accent);
    color: #991b1b;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

/* -- Top Bar -- */
.top-bar {
    background: var(--bg-dark);
    padding: 0;
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.top-bar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.site-logo {
    height: 55px;
    flex-shrink: 0;
}

.site-logo img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.top-bar__actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* -- Search Bar -- */
.search-bar {
    display: flex;
    align-items: stretch;
    border: 1px solid rgba(255,255,255,0.2);
}

.search-bar input {
    width: 300px;
    padding: 10px 16px;
    border: none;
    background: rgba(255,255,255,0.08);
    color: var(--white);
    font-family: inherit;
    font-size: 0.9rem;
}

.search-bar input::placeholder {
    color: rgba(255,255,255,0.5);
}

.search-bar input:focus {
    outline: none;
    background: rgba(255,255,255,0.12);
}

.search-bar button {
    padding: 10px 16px;
    background: var(--primary);
    border: none;
    color: var(--white);
    cursor: pointer;
    transition: background var(--transition);
}

.search-bar button:hover {
    background: var(--primary-dark);
}

/* -- Login Link -- */
.header-login {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all var(--transition);
}

.header-login:hover {
    color: var(--white);
    border-color: var(--primary);
    background: rgba(57,181,74,0.1);
}

/* -- User Menu (authenticated) -- */
.header-user {
    position: relative;
}

.header-user__toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all var(--transition);
    cursor: pointer;
}

.header-user__toggle:hover {
    color: var(--white);
    border-color: var(--primary);
    background: rgba(57,181,74,0.1);
}

.header-user__dropdown {
    display: none;
    position: absolute;
    top: 100%;
    padding-top: 8px;
    right: 0;
    min-width: 200px;
    background: transparent;
    z-index: 100;
}

.header-user__dropdown::before {
    content: '';
    display: block;
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    bottom: 0;
}

.header-user__dropdown a,
.header-user__dropdown form {
    position: relative;
    z-index: 1;
}

.header-user:hover .header-user__dropdown {
    display: block;
}

.header-user__dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.85rem;
    color: var(--text-medium);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    transition: all var(--transition);
}

.header-user__dropdown a:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.header-user__logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text-medium);
    background: var(--white);
    border: none;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition);
}

.header-user__logout:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* -- Main Navigation -- */
.main-nav {
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.main-nav .container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-list {
    display: flex;
    align-items: stretch;
    height: var(--nav-height);
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dark);
    transition: color var(--transition);
    cursor: pointer;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary);
}

/* Active indicator */
.nav-item:hover .nav-link::after,
.nav-item.active .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 3px;
    background: var(--primary);
}

/* -- Dropdown -- */
.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 260px;
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.nav-item:hover .nav-dropdown {
    display: block;
}

.nav-dropdown a {
    display: block;
    padding: 12px 20px;
    font-size: 0.85rem;
    color: var(--text-medium);
    border-bottom: 1px solid var(--border);
    transition: all var(--transition);
}

.nav-dropdown a:last-child {
    border-bottom: none;
}

.nav-dropdown a:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding-left: 24px;
}

/* -- Mobile Menu Toggle -- */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dark);
    cursor: pointer;
    padding: 8px;
}

/* -- Mobile Navigation -- */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    z-index: 2000;
    overflow-y: auto;
    padding: 24px;
}

.mobile-nav.active {
    display: block;
}

.mobile-nav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.mobile-nav__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dark);
    cursor: pointer;
    padding: 8px;
}

.mobile-nav__search {
    margin-bottom: 24px;
}

.mobile-nav__search .search-bar {
    border-color: var(--border);
}

.mobile-nav__search .search-bar input {
    background: var(--bg-alt);
    color: var(--text-dark);
    width: 100%;
}

.mobile-nav__search .search-bar input::placeholder {
    color: var(--text-light);
}

.mobile-nav__item {
    border-bottom: 1px solid var(--border);
}

.mobile-nav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dark);
    cursor: pointer;
}

.mobile-nav__link i {
    transition: transform var(--transition);
    font-size: 0.7rem;
}

.mobile-nav__item.active .mobile-nav__link i {
    transform: rotate(45deg);
}

.mobile-nav__sub {
    display: none;
    padding-bottom: 12px;
}

.mobile-nav__item.active .mobile-nav__sub {
    display: block;
}

.mobile-nav__sub a {
    display: block;
    padding: 10px 0 10px 16px;
    font-size: 0.85rem;
    color: var(--text-medium);
    border-left: 2px solid var(--border);
    transition: all var(--transition);
}

.mobile-nav__sub a:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--bg-dark);
    color: rgba(255,255,255,0.7);
    padding: 60px 0 0;
    margin-top: auto;
}

.footer__grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 0.8fr;
    gap: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer__title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--white);
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 12px;
}

.footer__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--primary);
}

.footer__links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.footer__links a {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    padding: 4px 0;
    transition: color var(--transition);
}

.footer__links a:hover {
    color: var(--primary);
}

/* Newsletter */
.footer__newsletter-form {
    display: flex;
    margin-top: 8px;
}

.footer__newsletter-form input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: var(--white);
    font-family: inherit;
    font-size: 0.9rem;
}

.footer__newsletter-form input::placeholder {
    color: rgba(255,255,255,0.4);
}

.footer__newsletter-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.footer__newsletter-form button {
    padding: 12px 20px;
    background: var(--primary);
    border: none;
    color: var(--white);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background var(--transition);
}

.footer__newsletter-form button:hover {
    background: var(--primary-dark);
}

/* Social */
.footer__social {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.footer__social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.6);
    font-size: 1rem;
    transition: all var(--transition);
}

.footer__social a:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* Bottom bar */
.footer__bottom {
    padding: 20px 0;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
}

/* ============================================================
   PAGE HEADER (breadcrumb area for inner pages)
   ============================================================ */
.page-header {
    background: var(--bg-dark);
    padding: 60px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(57,181,74,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.page-header h1 {
    color: var(--white);
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.page-header p {
    color: rgba(255,255,255,0.6);
    font-size: 1rem;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-wrapper {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    background: var(--white);
    border: 1px solid var(--border);
    transition: all var(--transition);
    text-decoration: none;
    cursor: pointer;
}

.pagination__item:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.pagination__item--active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination__item--active:hover {
    background: var(--primary-dark);
    color: var(--white);
}

.pagination__item--disabled {
    color: var(--text-light);
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination__item--disabled:hover {
    border-color: var(--border);
    color: var(--text-light);
    background: var(--white);
}

.pagination__item--dots {
    border: none;
    background: none;
    cursor: default;
    min-width: auto;
    padding: 0 4px;
}

.pagination__item--dots:hover {
    background: none;
    border: none;
    color: var(--text-dark);
}

.pagination__item i {
    font-size: 0.7rem;
}

/* Green accent line */
.accent-line {
    width: 60px;
    height: 3px;
    background: var(--primary);
}

.accent-line--center {
    margin: 16px auto;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
    :root {
        --section-padding: 60px 0;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }

    .grid--4 { grid-template-columns: repeat(2, 1fr); }
    .grid--3 { grid-template-columns: repeat(2, 1fr); }

    .footer__grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }

    .search-bar input {
        width: 200px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --section-padding: 48px 0;
        --header-height: 60px;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .container {
        padding: 0 16px;
    }

    .grid--2,
    .grid--3,
    .grid--4 {
        grid-template-columns: 1fr;
    }

    /* Header mobile — unified single bar */
    .top-bar__actions .search-bar,
    .top-bar__actions .header-login,
    .top-bar__actions .header-user {
        display: none;
    }

    .nav-toggle {
        display: block;
        color: var(--white);
    }

    .main-nav {
        display: none;
    }

    /* Footer mobile */
    .footer__grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .footer__links {
        grid-template-columns: 1fr;
    }

    .page-header {
        padding: 40px 0;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .section__header {
        margin-bottom: 32px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .top-bar {
        height: 56px;
    }

    .site-logo {
        height: 42px;
    }
}
