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

:root {
    --d101-dark: #272727;
    --d101-yellow: #f9da19;
    --d101-gray: #727272;
    --d101-dark-gray: #2d2d2d;
    --d101-light: #FCFCFC;
    --d101-white: #ffffff;
}

* {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--d101-light);
    color: var(--d101-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}
img {
    max-width: 100%;
    height: auto;
}

/* Navbar */
.navbar {
    background-color: var(--d101-dark) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 0.8rem 1rem;
}
.navbar-brand img {
    max-height: 40px;
}
.navbar .nav-link {
    color: var(--d101-white) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem !important;
    transition: color 0.2s;
}
.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--d101-yellow) !important;
}
.navbar-toggler {
    border-color: rgba(255,255,255,0.3);
    padding: 0.4rem 0.65rem;
}
.navbar-toggler:focus {
    box-shadow: 0 0 0 0.15rem rgba(249, 218, 25, 0.4);
}
@media (max-width: 991.98px) {
    .navbar-collapse {
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: 0.75rem;
    }
    .navbar .nav-link {
        padding: 0.6rem 0.5rem !important;
    }
}

/* Buttons */
.btn-primary {
    background-color: var(--d101-yellow) !important;
    border-color: var(--d101-yellow) !important;
    color: var(--d101-dark) !important;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    transition: all 0.2s;
}
.btn-primary:hover {
    background-color: #e5c817 !important;
    border-color: #e5c817 !important;
    color: var(--d101-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 218, 25, 0.3);
}
.btn-outline-primary {
    border-color: var(--d101-yellow) !important;
    color: var(--d101-dark) !important;
    font-weight: 600;
}
.btn-outline-primary:hover {
    background-color: var(--d101-yellow) !important;
    color: var(--d101-dark) !important;
}
.btn-dark {
    background-color: var(--d101-dark) !important;
    border-color: var(--d101-dark) !important;
}

/* Cards */
.card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.card-header {
    background-color: var(--d101-dark);
    color: var(--d101-white);
    font-weight: 600;
    border-radius: 8px 8px 0 0 !important;
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--d101-yellow);
    box-shadow: 0 0 0 0.2rem rgba(249, 218, 25, 0.25);
}
.form-label {
    font-weight: 500;
    color: var(--d101-dark);
    margin-bottom: 0.3rem;
}
.form-section {
    background: var(--d101-white);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e0e0e0;
}
.form-section h5 {
    color: var(--d101-dark);
    border-bottom: 2px solid var(--d101-yellow);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}
.form-section .info-text {
    background-color: #fff9e0;
    border-left: 4px solid var(--d101-yellow);
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border-radius: 0 4px 4px 0;
}

/* Footer */
.footer {
    background-color: var(--d101-dark);
    color: var(--d101-gray);
    padding: 1.5rem 0;
    margin-top: auto;
    font-size: 0.85rem;
}
.footer a {
    color: var(--d101-yellow);
    text-decoration: none;
}

/* Tables */
.table thead {
    background-color: var(--d101-dark);
    color: var(--d101-white);
}
.table thead th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.table td {
    word-break: break-word;
}

/* Form select cards */
.form-select-card {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.form-select-card .card {
    height: 100%;
}
.form-select-card .card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1rem;
}
.form-select-card .card-body .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--d101-yellow);
}

/* Auth pages */
.auth-container {
    max-width: 420px;
    margin: 3rem auto;
}
.auth-container .card {
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.auth-container .logo-section {
    text-align: center;
    padding: 2rem 2rem 1rem;
}
.auth-container .logo-section img {
    max-height: 60px;
}

/* Badge styles */
.badge-soc { background-color: #0d6efd; }
.badge-cibervigilancia { background-color: #6f42c1; }
.badge-concienciacion { background-color: #198754; }
.badge-ingenieria_social { background-color: #fd7e14; }
.badge-pentesting { background-color: #dc3545; }

/* Responsive */
@media (max-width: 991.98px) {
    /* Charts stack fully and get reasonable heights */
    .chart-container {
        min-height: 250px !important;
        height: auto;
    }
}

@media (max-width: 768px) {
    .form-section {
        padding: 1rem;
    }

    /* KPI cards: reduce padding and font size */
    .kpi-card {
        padding: 1rem;
        gap: 0.7rem;
    }
    .kpi-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
        border-radius: 10px;
    }
    .kpi-value {
        font-size: 1.4rem;
    }
    .kpi-label {
        font-size: 0.7rem;
    }

    /* Mini KPI: allow wrapping */
    .mini-kpi {
        font-size: 0.82rem;
        padding: 0.7rem 0.8rem;
    }

    /* User activity rows: stack on small screens */
    .user-activity-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .progress-bar-wrapper {
        min-width: 0;
        width: 100%;
    }

    /* Auth container: reduce top margin on mobile */
    .auth-container {
        margin: 1.5rem auto;
        padding: 0 0.5rem;
    }

    /* Tables: smaller text for readability */
    .table {
        font-size: 0.85rem;
    }
    .table thead th {
        font-size: 0.75rem;
    }

    /* Chart body: reduce padding */
    .chart-body {
        padding: 0.8rem;
    }

    /* Form titles: slightly smaller */
    .form-section h5 {
        font-size: 1.05rem;
    }
}

@media (max-width: 576px) {
    /* Even smaller screens */
    .kpi-card {
        padding: 0.8rem;
        gap: 0.5rem;
    }
    .kpi-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    .kpi-value {
        font-size: 1.2rem;
    }
    .kpi-label {
        font-size: 0.65rem;
    }

    /* Main container: breathing room on very small screens */
    main.container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Form select cards */
    .form-select-card .card-body {
        padding: 1.5rem 0.8rem;
    }
    .form-select-card .card-body .icon {
        font-size: 2rem;
        margin-bottom: 0.7rem;
    }

    /* Chart containers */
    .chart-container {
        min-height: 220px !important;
    }
}

/* Conditional form sections */
.conditional-section {
    display: none;
    animation: fadeIn 0.3s ease-in;
}
.conditional-section.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Statistics Dashboard */
.kpi-card {
    background: var(--d101-white);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.kpi-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--d101-dark);
    line-height: 1;
}
.kpi-label {
    font-size: 0.8rem;
    color: var(--d101-gray);
    font-weight: 500;
    margin-top: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mini-kpi {
    background: var(--d101-white);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.chart-card {
    background: var(--d101-white);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    height: 100%;
}
.chart-header {
    background-color: var(--d101-dark);
    color: var(--d101-white);
    padding: 0.9rem 1.2rem;
    font-weight: 600;
}
.chart-body {
    padding: 1.2rem;
}
.chart-container {
    position: relative;
    width: 100%;
}

.user-activity-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.user-activity-row:last-child {
    border-bottom: none;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--d101-dark);
    color: var(--d101-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    margin-right: 0.8rem;
    flex-shrink: 0;
}
.progress-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
}
.progress-bar-wrapper .progress {
    flex-grow: 1;
    background-color: #f0f0f0;
    border-radius: 3px;
}

.cursor-pointer {
    cursor: pointer;
}
.cursor-pointer:hover {
    background-color: #f8f9fa !important;
}
