:root {
    --primary:       #1565c0;
    --primary-dark:  #0d47a1;
    --primary-light: #42a5f5;
    --accent:        #667eea;
    --accent2:       #764ba2;
    --text-dark:     #1a202c;
    --text-mid:      #4a5568;
    --text-light:    #718096;
    --card-bg:       rgba(255, 255, 255, 0.97);
    --card-border:   rgba(255, 255, 255, 0.6);
    --shadow-card:   0 4px 24px rgba(0, 0, 30, 0.12);
    --shadow-hover:  0 12px 40px rgba(0, 0, 30, 0.22);
    --radius-card:   18px;
    --radius-icon:   14px;
    --gap:           22px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ── FUNDO ─────────────────────────────── */

.background-animated {
    position: fixed;
    inset: 0;
    background: url("./background.jpg") center center / cover no-repeat;
    z-index: -2;
}

.background-animated::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 18, 40, 0.35);
    backdrop-filter: blur(2px);
}

/* ── CONTAINER PRINCIPAL ────────────────── */

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 48px 24px 32px;
    position: relative;
    z-index: 1;
}

/* ── HEADER ─────────────────────────────── */

.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 48px;
    animation: fadeInDown 0.7s ease-out;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-bottom: 12px;
}

.logo-header {
    width: 56px;
    height: 56px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
    transition: transform 0.3s ease;
}

.logo-header:hover {
    transform: scale(1.08) rotate(4deg);
}

.header h1 {
    color: #fff;
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    max-width: 540px;
    line-height: 1.6;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ── GRID DE CARDS ──────────────────────── */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--gap);
    margin-bottom: 48px;
    animation: fadeInUp 0.7s ease-out;
}

/* ── CARD ────────────────────────────────── */

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
    padding: 28px 24px 22px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

/* linha de cor no topo — sempre visível, tom suave */
.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.card:hover {
    transform: translateY(-7px);
    box-shadow: var(--shadow-hover);
    background: #ffffff;
}

.card:hover::after {
    opacity: 1;
}

/* ── ÍCONE DO CARD ──────────────────────── */

.card-icon-wrapper {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-icon);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 4px 14px rgba(21, 101, 192, 0.35);
    flex-shrink: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover .card-icon-wrapper {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(21, 101, 192, 0.45);
}

/* ── CORPO DO CARD ──────────────────────── */

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
    width: 100%;
}

.card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
}

.card-description {
    font-size: 0.875rem;
    color: var(--text-light);
    line-height: 1.55;
}

/* ── RODAPÉ DO CARD ─────────────────────── */

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    margin-top: auto;
    min-height: 28px;
    width: 100%;
}

/* ── STATUS ─────────────────────────────── */

.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: 0.2px;
}

.status-active {
    color: #2e7d32;
    background: rgba(76, 175, 80, 0.12);
}

.status-active i {
    font-size: 0.5rem;
    animation: pulse 2s infinite;
}

.status-inactive {
    color: #bf360c;
    background: rgba(255, 152, 0, 0.12);
}

.status-inactive i {
    font-size: 0.5rem;
}

.status-maintenance {
    color: #7a5c00;
    background: rgba(255, 213, 0, 0.22);
}

.status-maintenance i {
    font-size: 0.72rem;
}

.card.maintenance {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(30%);
}

/* ── LINK DE ACESSO ─────────────────────── */

.access-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    transition: gap 0.25s ease, color 0.2s ease;
}

.card:hover .access-link {
    gap: 8px;
    color: var(--primary-dark);
}

/* ── LOADING ─────────────────────────────── */

.loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    padding: 60px;
    grid-column: 1 / -1;
    letter-spacing: 0.5px;
}

/* ── FOOTER ──────────────────────────────── */

.footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.65);
    padding: 24px 0 16px;
    font-size: 0.85rem;
    animation: fadeInUp 0.7s ease-out;
}

.footer p { margin: 4px 0; }

.signature {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.signature a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: color 0.2s, transform 0.2s;
    position: relative;
}

.signature a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: #fff;
    transform: scaleX(0);
    transition: transform 0.25s ease;
    transform-origin: center;
}

.signature a:hover { color: #fff; transform: translateY(-1px); }
.signature a:hover::after { transform: scaleX(1); }
.signature span { color: rgba(255, 255, 255, 0.5); }

/* ── MODAL ───────────────────────────────── */

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    animation: fadeIn 0.25s;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: #fff;
    margin: 5vh auto;
    border-radius: 20px;
    width: 100%;
    max-width: 720px;
    max-height: 88vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: modalIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
}

.close-modal {
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}

.close-modal:hover { opacity: 1; transform: scale(1.15); }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.ramal-info {
    background: #e8f0fe;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-dark);
    font-size: 0.9rem;
    font-weight: 500;
}

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

.ramais-table th {
    background: #f7f8fa;
    padding: 11px 14px;
    text-align: left;
    font-weight: 700;
    color: var(--text-mid);
    border-bottom: 2px solid #e2e8f0;
}

.ramais-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #edf2f7;
    color: var(--text-dark);
}

.ramais-table tr:last-child td { border-bottom: none; }
.ramais-table tr:hover td { background: #f7f9ff; }

/* ── ANIMAÇÕES ───────────────────────────── */

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── RESPONSIVIDADE ──────────────────────── */

@media (max-width: 768px) {
    .container { padding: 32px 16px 24px; }
    .header h1 { font-size: 1.9rem; }
    .header { margin-bottom: 32px; }
    .cards-grid { gap: 16px; }
}

@media (max-width: 480px) {
    .header h1 { font-size: 1.5rem; }
    .subtitle  { font-size: 0.875rem; }
    .logo-header { width: 44px; height: 44px; }
    .cards-grid { grid-template-columns: 1fr; }
    .modal { padding: 12px; }
    .modal-content { margin: 2vh auto; }
}
