/* =============================================
   FDSQuímicos — CSS Principal
   Tema: Dark Mode Industrial / Segurança Química
============================================= */

@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700;800&family=Barlow+Condensed:wght@600;700;800&display=swap');

:root {
    --fds-bg: #343a40;
    --fds-bg-2: #161b22;
    --fds-bg-3: #343a41;
    --fds-border: #30363d;
    --fds-accent: #ff6c28;
    --fds-accent-2: #ff6c28;
    --fds-yellow: #e3b341;
    --fds-blue: #58a6ff;
    --fds-green: #3fb950;
    --fds-text: #e6edf3;
    --fds-text-muted: #8b949e;
    --fds-font: 'Barlow', sans-serif;
    --fds-font-cond: 'Barlow Condensed', sans-serif;
}

* { box-sizing: border-box; }

body.dark-mode, body.fds-public, body.fds-admin-body {
    font-family: var(--fds-font) !important;
    background-color: var(--fds-bg) !important;
    color: var(--fds-text) !important;
}

/* =============================================
   HEADER / NAVBAR
============================================= */
.fds-header {
    background: var(--fds-bg-2) !important;
    border-bottom: 2px solid var(--fds-accent) !important;
    box-shadow: 0 2px 20px rgba(248, 81, 73, 0.15) !important;
    padding: 0 1.5rem !important;
    height: 60px;
}

.fds-brand {
    display: flex !important;
    align-items: center !important;
    gap: 10px;
    text-decoration: none !important;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--fds-accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

/*.brand-text {*/
/*    font-family: var(--fds-font-cond) !important;*/
/*    font-size: 1.5rem !important;*/
/*    font-weight: 800 !important;*/
/*    color: var(--fds-text) !important;*/
/*    letter-spacing: 1px;*/
/*    text-transform: uppercase;*/
/*}*/

.brand-accent {
    color: var(--fds-accent) !important;
}

.header-badge {
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: var(--fds-accent-2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-admin {
    background: transparent !important;
    border: 1px solid var(--fds-border) !important;
    color: var(--fds-text-muted) !important;
    font-size: 0.8rem !important;
    transition: all 0.2s;
}

.btn-admin:hover {
    border-color: var(--fds-accent) !important;
    color: var(--fds-accent) !important;
}

/* =============================================
   HERO SECTION
============================================= */
.fds-hero {
    background: linear-gradient(135deg, #0d1117 0%, #1a0f0e 50%, #0d1117 100%);
    padding: 70px 0 50px;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--fds-border);
}

.hero-icon-wrapper {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--fds-accent), #c0392b);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin: 0 auto;
    box-shadow: 0 8px 30px rgba(248, 81, 73, 0.35);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 8px 30px rgba(248, 81, 73, 0.35); }
    50% { box-shadow: 0 8px 50px rgba(248, 81, 73, 0.6); }
}

.hero-title {
    font-family: var(--fds-font-cond) !important;
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--fds-text);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--fds-text-muted);
    margin-bottom: 0;
}

/* Search */
.search-wrapper {
    max-width: 560px;
    margin: 0 auto;
}

.fds-search-input {
    background: var(--fds-bg-2) !important;
    border: 2px solid var(--fds-border) !important;
    color: var(--fds-text) !important;
    font-size: 1rem !important;
    height: 52px !important;
    padding-left: 20px !important;
    border-radius: 12px 0 0 12px !important;
    transition: border-color 0.2s;
}

.fds-search-input:focus {
    border-color: var(--fds-accent) !important;
    box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.15) !important;
    outline: none !important;
}

.fds-search-input::placeholder { color: var(--fds-text-muted) !important; }

.btn-search {
    background: var(--fds-accent) !important;
    border-color: var(--fds-accent) !important;
    color: white !important;
    height: 52px !important;
    padding: 0 20px !important;
    font-size: 1rem !important;
}

.btn-clear {
    background: var(--fds-bg-3) !important;
    border-color: var(--fds-border) !important;
    color: var(--fds-text-muted) !important;
    height: 52px !important;
    padding: 0 16px !important;
    border-radius: 0 12px 12px 0 !important;
}

/* Particles */
.hero-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.hero-particles span {
    position: absolute;
    display: block;
    width: 4px;
    height: 4px;
    background: var(--fds-accent);
    border-radius: 50%;
    opacity: 0;
    animation: float-up 8s ease-in-out infinite;
}
.hero-particles span:nth-child(1)  { left: 10%; animation-delay: 0s;   width: 3px;  height: 3px;  }
.hero-particles span:nth-child(2)  { left: 25%; animation-delay: 1.5s; width: 5px;  height: 5px;  }
.hero-particles span:nth-child(3)  { left: 40%; animation-delay: 0.8s; width: 3px;  height: 3px;  }
.hero-particles span:nth-child(4)  { left: 55%; animation-delay: 2.2s; width: 4px;  height: 4px;  }
.hero-particles span:nth-child(5)  { left: 70%; animation-delay: 1.1s; width: 6px;  height: 6px;  }
.hero-particles span:nth-child(6)  { left: 82%; animation-delay: 0.3s; width: 3px;  height: 3px;  }
.hero-particles span:nth-child(7)  { left: 15%; animation-delay: 3s;   width: 5px;  height: 5px;  }
.hero-particles span:nth-child(8)  { left: 65%; animation-delay: 2.7s; width: 3px;  height: 3px;  }
.hero-particles span:nth-child(9)  { left: 90%; animation-delay: 1.8s; width: 4px;  height: 4px;  }
.hero-particles span:nth-child(10) { left: 48%; animation-delay: 4s;   width: 3px;  height: 3px;  }
@keyframes float-up {
    0%   { transform: translateY(100%) scale(0); opacity: 0; }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.2; }
    100% { transform: translateY(-400px) scale(1.5); opacity: 0; }
}

/* =============================================
   MAIN CONTENT — GRID DE FICHAS
============================================= */
.fds-main-content {
    padding: 40px 0 60px;
    min-height: calc(100vh - 320px);
}

.search-info {
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--fds-blue);
    font-size: 0.9rem;
}

/* FDS Cards */
.fds-card {
    display: flex;
    text-decoration: none !important;
    transition: transform 0.2s, box-shadow 0.2s;
}

.fds-card:hover { transform: translateY(-4px); }

.fds-card-inner {
    position: relative;
    overflow: hidden;
    background: var(--fds-bg-2);
    border: 1px solid var(--fds-border);
    border-radius: 14px;
    padding: 20px 14px 16px;
    text-align: center;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.fds-card:hover .fds-card-inner {
    border-color: var(--fds-accent);
    box-shadow: 0 8px 32px rgba(248, 81, 73, 0.2);
}

.fds-card-icon {
    position: relative;
    display: inline-block;
    margin-bottom: 10px;
}

.fds-card-icon .fa-file-pdf {
    font-size: 2.8rem;
    color: var(--fds-accent);
    transition: color 0.2s;
}

.fds-card:hover .fds-card-icon .fa-file-pdf { color: var(--fds-accent-2); }

.pdf-badge {
    position: absolute;
    bottom: -2px;
    right: -8px;
    background: var(--fds-accent);
    color: white;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.fds-card-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.fds-card-name {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--fds-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fds-card-date {
    font-size: 0.7rem;
    color: var(--fds-text-muted);
}

.fds-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(248, 81, 73, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: white;
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 700;
    font-size: 0.85rem;
}

.fds-card-overlay i { font-size: 1.5rem; }
.fds-card:hover .fds-card-overlay { opacity: 1; }

/* Empty state */
.empty-state .empty-icon {
    font-size: 4rem;
    color: var(--fds-text-muted);
    opacity: 0.4;
}

/* =============================================
   VIEWER PAGE
============================================= */
.fds-viewer-page { padding-top: 60px; }

.viewer-info-bar {
    background: var(--fds-bg-2);
    border: 1px solid var(--fds-border);
    border-radius: 12px;
    padding: 20px 24px;
}

.viewer-title {
    font-family: var(--fds-font-cond);
    font-weight: 700;
    font-size: 1.6rem;
    color: var(--fds-text);
    margin-bottom: 6px;
}

.viewer-desc {
    color: var(--fds-text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.btn-download {
    background: var(--fds-accent) !important;
    border-color: var(--fds-accent) !important;
    color: white !important;
    font-weight: 700 !important;
    padding: 10px 24px !important;
    border-radius: 8px !important;
    transition: background 0.2s !important;
}

.btn-download:hover { background: #c0392b !important; }

.pdf-viewer-wrapper {
    background: var(--fds-bg-2);
    border: 1px solid var(--fds-border);
    border-radius: 12px;
    overflow: hidden;
    height: calc(100vh - 260px);
    min-height: 500px;
    position: relative;
}

.pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.pdf-mobile-fallback { display: none; }

@media (max-width: 768px) {
    .pdf-iframe { display: none; }
    .pdf-mobile-fallback { display: block !important; }
    .pdf-viewer-wrapper { height: auto; min-height: unset; }
}

/* =============================================
   FOOTER
============================================= */
.fds-footer {
    background: var(--fds-bg-2);
    border-top: 1px solid var(--fds-border);
    padding: 20px 0;
    color: var(--fds-text-muted);
    font-size: 0.85rem;
}

/* =============================================
   LOGIN
============================================= */
.fds-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--fds-bg) !important;
}

.fds-login-logo {
    text-align: center;
    color: var(--fds-text) !important;
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.brand-icon-lg {
    width: 70px;
    height: 70px;
    background: var(--fds-accent);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(248, 81, 73, 0.35);
}

.fds-login-card {
    background: var(--fds-bg-2) !important;
    border: 1px solid var(--fds-border) !important;
    border-radius: 14px !important;
}

.fds-login-card .login-card-body {
    background: var(--fds-bg-2) !important;
    color: var(--fds-text) !important;
}

.fds-login-card .form-control {
    background: var(--fds-bg-3) !important;
    border-color: var(--fds-border) !important;
    color: var(--fds-text) !important;
}

.fds-login-card .input-group-text {
    background: var(--fds-bg-3) !important;
    border-color: var(--fds-border) !important;
    color: var(--fds-text-muted) !important;
}

.btn-fds-login {
    background: var(--fds-accent) !important;
    border-color: var(--fds-accent) !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    height: 48px !important;
}

/* =============================================
   ANIMATIONS
============================================= */
.fds-card-col {
    animation: fade-in-up 0.4s ease both;
}

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fds-card-col:nth-child(1)  { animation-delay: 0.03s; }
.fds-card-col:nth-child(2)  { animation-delay: 0.06s; }
.fds-card-col:nth-child(3)  { animation-delay: 0.09s; }
.fds-card-col:nth-child(4)  { animation-delay: 0.12s; }
.fds-card-col:nth-child(5)  { animation-delay: 0.15s; }
.fds-card-col:nth-child(6)  { animation-delay: 0.18s; }
.fds-card-col:nth-child(7)  { animation-delay: 0.21s; }
.fds-card-col:nth-child(8)  { animation-delay: 0.24s; }
.fds-card-col:nth-child(9)  { animation-delay: 0.27s; }
.fds-card-col:nth-child(10) { animation-delay: 0.30s; }
.fds-card-col:nth-child(11) { animation-delay: 0.33s; }
.fds-card-col:nth-child(12) { animation-delay: 0.36s; }

/* =============================================
   RESPONSIVO
============================================= */
@media (max-width: 576px) {
    .hero-title { font-size: 1.8rem; }
    .hero-icon-wrapper { width: 60px; height: 60px; font-size: 1.4rem; }
    .fds-header { padding: 0 0.75rem !important; }
}
