/* links.css - Estilo unificado baseado no index.html */

/* ========= VARIÁVEIS DO SISTEMA ========= */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #f39c12;
    --tertiary-color: #2ecc71;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --light-text: #666;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition-speed: 0.3s;
}

/* ========= LOADING SCREEN ========= */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: white;
    margin-top: 20px;
    font-size: 1rem;
    opacity: 0.8;
    font-weight: 300;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

body.loaded .loading {
    opacity: 0;
    pointer-events: none;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --primary-color: #64b5f6;
    --secondary-color: #ffb74d;
    --tertiary-color: #81c784;
    --text-color: #e0e0e0;
    --bg-color: #1a1a1a;
    --light-text: #aaa;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --card-hover-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

/* ========= RESET E BASE ========= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    height: 100%;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
    transition: background-color var(--transition-speed) ease;
    line-height: 1.6;
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-attachment: fixed;
}

/* ========= FORMAS ANIMADAS DE FUNDO ========= */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    opacity: 0.12;
    z-index: 0;
    animation: float 20s infinite ease-in-out;
    pointer-events: none;
}

.shape-1 {
    width: min(300px, 40vw);
    height: min(300px, 40vw);
    background: rgba(74, 144, 226, 0.4);
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}

.shape-2 {
    width: min(200px, 30vw);
    height: min(200px, 30vw);
    background: rgba(243, 156, 18, 0.4);
    bottom: 10%;
    right: 5%;
    animation-delay: 5s;
}

.shape-3 {
    width: min(250px, 35vw);
    height: min(250px, 35vw);
    background: rgba(46, 204, 113, 0.4);
    top: 60%;
    left: 10%;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(20px, -30px) rotate(120deg);
    }
    66% {
        transform: translate(-15px, 15px) rotate(240deg);
    }
}

/* ========= CONTROLES FIXOS ========= */
.clock {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    font-weight: 600;
    color: var(--text-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    animation: slideInLeft 0.8s ease-out;
    max-width: calc(100% - 120px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all var(--transition-speed) ease;
}

[data-theme="dark"] .clock {
    background: rgba(30, 30, 30, 0.95);
}

.clock i {
    color: var(--primary-color);
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* ========= BOTÃO DE TEMA ========= */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: none;
    width: 46px;
    height: 46px;
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-color);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) ease;
    box-shadow: var(--card-shadow);
    z-index: 1000;
    animation: slideInRight 0.8s ease-out;
}

[data-theme="dark"] .theme-toggle {
    background: rgba(30, 30, 30, 0.95);
}

.theme-toggle:hover {
    transform: rotate(15deg);
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(40, 40, 40, 0.95);
}

.theme-toggle i {
    position: absolute;
    transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.theme-toggle .fa-sun {
    color: var(--secondary-color);
}

.theme-toggle .fa-moon {
    color: var(--primary-color);
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="dark"] .theme-toggle .fa-sun {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .theme-toggle .fa-moon {
    opacity: 1;
    transform: rotate(0deg);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========= HEADER ========= */
.portal-header {
    text-align: center;
    color: white;
    width: 100%;
    max-width: 800px;
    margin-bottom: 3rem;
    padding-top: 40px;
}

.header-content {
    padding: 0 20px;
    position: relative;
}

.portal-title {
    font-size: clamp(1.5rem, 3vw, 1.9rem);
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.3px;
    line-height: 1.3;
    animation: fadeInDown 0.8s ease-out;
    position: relative;
    display: inline-block;
    padding-bottom: 15px;
}

.portal-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, 
        var(--tertiary-color) 0%, 
        var(--tertiary-color) 20%, 
        var(--secondary-color) 20%, 
        var(--secondary-color) 100%);
    border-radius: 2px;
}

.portal-subtitle {
    font-size: clamp(0.85rem, 1.6vw, 1rem);
    opacity: 0.9;
    font-weight: 400;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.back-button {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    text-decoration: none;
    z-index: 1001;
    animation: slideInLeft 0.8s ease-out;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========= CONTAINER PRINCIPAL ========= */
.container {
    width: 100%;
    min-height: 100vh;
    padding: 80px 20px 20px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
    max-width: 1200px;
}

/* ========= CONTEÚDO PRINCIPAL ========= */
.main-content {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 0 0 30px;
}

/* ========= GRADE DE LINKS ========= */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    width: 100%;
    margin: 0 auto;
}

/* ========= CARDS DOS LINKS ========= */
.link-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    text-decoration: none;
    color: inherit;
    display: block;
    animation: fadeInUp 0.6s ease-out backwards;
    height: 100%;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .link-card {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--tertiary-color) 0%, 
        var(--tertiary-color) 20%, 
        var(--secondary-color) 20%, 
        var(--secondary-color) 100%);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transition: transform var(--transition-speed) ease;
    transform: scaleX(0);
    transform-origin: left;
}

.link-card:hover::before,
.link-card:focus::before {
    transform: scaleX(1);
}

.link-card:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 3px;
}

.link-card:hover,
.link-card:focus {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--secondary-color);
}

/* ========= ÍCONES DOS LINKS ========= */
.link-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) ease;
}

.link-card:hover .link-icon,
.link-card:focus .link-icon {
    transform: rotateY(360deg) scale(1.05);
    box-shadow: var(--card-hover-shadow);
}

/* Cores dos ícones */
.link-icon.email { background: linear-gradient(135deg, #d44638, #c23321); }
.link-icon.ticket { background: linear-gradient(135deg, #ff6b6b, #ee5a52); }
.link-icon.erp { background: linear-gradient(135deg, var(--primary-color), #3a7bc8); }
.link-icon.website { background: linear-gradient(135deg, var(--tertiary-color), #27ae60); }
.link-icon.security { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.link-icon.training { background: linear-gradient(135deg, var(--secondary-color), #e67e22); }
.link-icon.hr { background: linear-gradient(135deg, #3498db, #2980b9); }
.link-icon.payroll { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.link-icon.support { background: linear-gradient(135deg, #1abc9c, #16a085); }
.link-icon.chatbot { background: linear-gradient(135deg, #6a5acd, #836fff); }
.link-icon.finance { background: linear-gradient(135deg, #34495e, #2c3e50); }
.link-icon.telephony { background: linear-gradient(135deg, #7f8c8d, #95a5a6); }
.link-icon.document { background: linear-gradient(135deg, #f39c12, #d68910); }
.link-icon.it { background: linear-gradient(135deg, #8e44ad, #7d3c98); }
.link-icon.management { background: linear-gradient(135deg, #2c3e50, #1a252f); }
.link-icon.internal { background: linear-gradient(135deg, #7f8c8d, #616a6b); }

/* ========= TEXTOS DOS CARDS ========= */
.link-card h3 {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 10px;
    text-align: center;
    font-weight: 600;
    line-height: 1.3;
}

.link-card p {
    color: var(--light-text);
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
    max-width: 250px;
}

/* ========= BADGE DE TIPO ========= */
.link-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(74, 144, 226, 0.1);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 auto;
    transition: all var(--transition-speed) ease;
}

[data-theme="dark"] .link-badge {
    background: rgba(100, 181, 246, 0.15);
}

.link-card:hover .link-badge,
.link-card:focus .link-badge {
    background: rgba(243, 156, 18, 0.15);
    color: var(--secondary-color);
    transform: scale(1.05);
}

/* ========= FOOTER ========= */
footer {
    background: var(--primary-color);
    color: white;
    padding: 18px;
    position: relative;
    z-index: 1;
    text-align: center;
    width: 100%;
    max-width: 800px;
    border-radius: var(--border-radius);
    margin-top: 3rem;
    font-size: 0.85rem;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) ease;
}

footer p {
    margin: 0;
    line-height: 1.6;
}

footer a {
    color: white;
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

footer a:hover {
    color: var(--secondary-color);
}

/* ========= RESPONSIVIDADE ========= */
@media (max-width: 768px) {
    .container {
        padding: 70px 15px 15px;
    }
    
    .clock {
        top: 15px;
        left: 15px;
        padding: 10px 16px;
        font-size: 0.85rem;
        max-width: calc(100% - 110px);
    }
    
    .theme-toggle {
        top: 15px;
        right: 15px;
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
    
    .back-button {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .portal-header {
        margin-bottom: 2rem;
        padding-top: 30px;
    }
    
    .header-content {
        padding: 0 15px 0 60px;
    }
    
    .links-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 450px;
    }
    
    .link-card {
        min-height: 180px;
        padding: 25px 20px;
    }
    
    .link-icon {
        width: 70px;
        height: 70px;
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    footer {
        margin-top: 2rem;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 65px 12px 12px;
    }
    
    .clock {
        top: 12px;
        left: 12px;
        padding: 9px 14px;
        font-size: 0.8rem;
        max-width: calc(100% - 100px);
    }
    
    .theme-toggle {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .back-button {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .portal-title {
        font-size: 1.4rem;
    }
    
    .portal-subtitle {
        font-size: 0.85rem;
    }
    
    .header-content {
        padding: 0 12px 0 50px;
    }
    
    .links-grid {
        gap: 20px;
    }
    
    .link-card {
        min-height: 160px;
        padding: 20px 15px;
    }
    
    .link-icon {
        width: 60px;
        height: 60px;
        font-size: 1.8rem;
    }
    
    .link-card h3 {
        font-size: 1.1rem;
    }
    
    .link-card p {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    
    .link-badge {
        font-size: 0.7rem;
        padding: 7px 14px;
    }
    
    footer {
        padding: 12px;
        font-size: 0.8rem;
        margin-top: 1.5rem;
    }
}

/* ========= ANIMAÇÕES ESCALONADAS ========= */
.link-card:nth-child(1) { animation-delay: 0.1s; }
.link-card:nth-child(2) { animation-delay: 0.2s; }
.link-card:nth-child(3) { animation-delay: 0.3s; }
.link-card:nth-child(4) { animation-delay: 0.4s; }
.link-card:nth-child(5) { animation-delay: 0.5s; }
.link-card:nth-child(6) { animation-delay: 0.6s; }
.link-card:nth-child(7) { animation-delay: 0.7s; }
.link-card:nth-child(8) { animation-delay: 0.8s; }
.link-card:nth-child(9) { animation-delay: 0.9s; }
.link-card:nth-child(10) { animation-delay: 1.0s; }
.link-card:nth-child(11) { animation-delay: 1.1s; }
.link-card:nth-child(12) { animation-delay: 1.2s; }

/* ========= ESTILOS PARA TEMA ESCURO ESPECÍFICOS ========= */
[data-theme="dark"] .clock i {
    color: var(--secondary-color);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(50, 50, 50, 0.95);
}

[data-theme="dark"] footer {
    background: linear-gradient(135deg, #64b5f6, #3a7bc8);
}

/* ========= ACESSIBILIDADE ========= */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.link-card:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 3px;
}

.back-button:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* ========= SCROLLBAR PERSONALIZADA ========= */
@media (min-width: 768px) {
    ::-webkit-scrollbar {
        width: 10px;
    }
    
    ::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 5px;
    }
    
    ::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 5px;
        transition: background var(--transition-speed) ease;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: var(--secondary-color);
    }
    
    [data-theme="dark"] ::-webkit-scrollbar-track {
        background: #2d2d2d;
    }
    
    [data-theme="dark"] ::-webkit-scrollbar-thumb {
        background: var(--secondary-color);
    }
    
    [data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
        background: var(--tertiary-color);
    }
}