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

:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #f37021; /* Coral Orange from logo */
    --accent-hover: #e05300; /* Darker Orange */
    --accent-secondary: #9c27b0; /* Magenta/Purple from logo */
    --accent-muted: rgba(243, 112, 33, 0.15);
    --gradient-accent: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent) 100%);
    --gradient-accent-hover: linear-gradient(135deg, #c026d3 0%, var(--accent-hover) 100%);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --bg-dark: #020617;
    --bg-card: rgba(30, 41, 59, 0.35);
    --border: rgba(255, 255, 255, 0.08);
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.8) 0%, rgba(2, 6, 23, 0.95) 90%);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
    letter-spacing: -0.01em;
}

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

button, input, select, textarea {
    font-family: 'Inter', sans-serif;
}

/* Keyboard Visibility Outline for Accessibility */
:focus-visible {
    outline: 3px solid var(--accent) !important;
    outline-offset: 4px !important;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--primary);
    padding: 12px 24px;
    font-weight: 700;
    border-radius: 0 0 12px 12px;
    z-index: 99999;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* Glassmorphism background */
.glass {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
}

/* Header */
.intranet-header {
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    padding: 16px 5%;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-img {
    height: 38px;
    border-radius: 6px;
    background: #ffffff;
    padding: 3px 8px;
    display: inline-block;
    object-fit: contain;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
}

.logo-img:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 16px rgba(243, 112, 33, 0.25);
}

.badge-intranet {
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(243, 112, 33, 0.15);
    color: var(--accent);
    border: 1px solid rgba(243, 112, 33, 0.3);
    padding: 2px 8px;
    border-radius: 50px;
    letter-spacing: 0.05em;
    margin-left: 6px;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #ffffff;
}

.user-role-badge {
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
}

.logout-btn {
    background: transparent;
    border: 1.5px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    transform: translateY(-1px);
}

/* Main Container */
.intranet-main {
    flex: 1;
    margin-top: 100px;
    padding: 40px 5%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 1440px;
    width: 100%;
    margin-inline: auto;
}

/* Setup & Auth Glass Containers */
.glass-container {
    width: 100%;
    max-width: 480px;
    margin: 40px 0;
}

.auth-box {
    padding: 48px 40px;
    border-radius: 28px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.auth-header {
    text-align: center;
    margin-bottom: 35px;
}

.auth-header h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2e8f0;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid var(--border);
    color: #ffffff;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.15);
}

.auth-submit-btn {
    background: var(--gradient-accent);
    color: #ffffff;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(243, 112, 33, 0.2);
}

.auth-submit-btn:hover {
    background: var(--gradient-accent-hover);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(243, 112, 33, 0.4);
}

.auth-toggle {
    margin-top: 24px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.text-link {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    margin-left: 4px;
    text-decoration: underline;
}

.text-link:hover {
    color: var(--accent-hover);
}

.setup-instructions {
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Pending Activation Panel */
.text-center {
    text-align: center;
}

.pending-message {
    margin: 24px 0 32px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: #e2e8f0;
}

.highlight-text {
    border-left: 3px solid var(--accent);
    padding-left: 14px;
    font-weight: 500;
    color: #ffffff;
}

.logout-pending-btn {
    background: transparent;
    color: #ef4444;
    border: 1.5px solid rgba(239, 68, 68, 0.3);
    width: 100%;
}

.logout-pending-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
}

/* ==========================================================================
   CLIENTE & ADMIN DASHBOARDS GENERAL LAYOUT
   ========================================================================== */
.dashboard-section {
    width: 100%;
    margin-bottom: 40px;
    animation: fadeIn 0.4s ease-out;
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 32px;
    width: 100%;
}

/* Columns Base */
.folders-column,
.files-column {
    border-radius: 24px;
    overflow: hidden;
}

.column-header {
    padding: 24px 30px;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.4);
}

.column-header h3 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.column-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Folders Sidebar / List */
.folders-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
}

.folder-item {
    padding: 14px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: var(--transition);
}

.folder-item i {
    font-size: 1.4rem;
    color: var(--accent);
    transition: var(--transition);
}

.folder-item span {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-item:hover {
    background: rgba(251, 191, 36, 0.05);
    border-color: rgba(251, 191, 36, 0.2);
    transform: translateX(4px);
}

.folder-item.active {
    background: var(--accent-muted);
    border-color: rgba(251, 191, 36, 0.4);
}

.folder-item.active i {
    transform: scale(1.1);
    color: var(--accent-hover);
}

.sidebar-form {
    padding: 20px 20px 0;
}

.form-group-compact {
    display: flex;
    gap: 8px;
}

.form-group-compact input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid var(--border);
    color: #ffffff;
    font-size: 0.85rem;
    transition: var(--transition);
}

.form-group-compact input:focus {
    outline: none;
    border-color: var(--accent);
}

.compact-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--gradient-accent);
    border: none;
    color: #ffffff;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.compact-btn:hover {
    background: var(--gradient-accent-hover);
    color: #ffffff;
}

/* Files Grid / list */
.files-grid-container {
    padding: 30px;
    min-height: 400px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 300px;
    color: var(--text-muted);
    gap: 16px;
}

.empty-state i {
    font-size: 3.5rem;
    color: rgba(255, 255, 255, 0.1);
}

.empty-state p {
    max-width: 320px;
    font-size: 0.95rem;
}

.loading-placeholder {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.file-card {
    padding: 24px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.file-card:hover {
    transform: translateY(-4px);
    border-color: rgba(251, 191, 36, 0.25);
    background: rgba(30, 41, 59, 0.5);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.file-type-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
    transition: var(--transition);
}

.file-card:hover .file-type-icon {
    background: var(--accent);
    color: var(--primary);
}

.file-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #ffffff;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size,
.file-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-date {
    margin-top: 2px;
    margin-bottom: 20px;
}

.download-link {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.download-link:hover {
    background: var(--accent);
    color: var(--primary);
    border-color: var(--accent);
}

.delete-file-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition);
}

.file-card:hover .delete-file-btn {
    opacity: 1;
}

.delete-file-btn:hover {
    color: #ef4444;
}

/* Upload Form Inline */
.upload-inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.file-drop-area {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1.5px dashed rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
}

.file-drop-area:hover {
    border-color: var(--accent);
    color: #ffffff;
}

.upload-btn {
    padding: 10px 18px;
    border-radius: 8px;
    background: var(--gradient-accent);
    border: none;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.upload-btn:hover {
    background: var(--gradient-accent-hover);
    color: #ffffff;
}

/* ==========================================================================
   ADMIN DASHBOARD TABS AND TABLES
   ========================================================================== */

.admin-tabs {
    display: flex;
    gap: 12px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 30px;
}

.tab-btn {
    padding: 14px 28px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.tab-btn:hover {
    color: #ffffff;
}

.tab-btn.active {
    color: var(--accent);
    border-color: var(--accent);
}

.admin-card {
    border-radius: 24px;
    padding: 30px;
}

.card-header {
    margin-bottom: 30px;
}

.card-header h3 {
    font-size: 1.4rem;
}

.card-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Admin Users Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th,
.admin-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    font-family: 'Outfit', sans-serif;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    background: rgba(15, 23, 42, 0.4);
}

.admin-table tbody tr {
    transition: var(--transition);
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.admin-table td {
    font-size: 0.9rem;
    color: #e2e8f0;
}

/* Custom Activation Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #94a3b8;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

input:checked + .slider:before {
    background-color: #10b981;
    transform: translateX(24px);
}

/* Toast System */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 28px;
    border-radius: 12px;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 10000;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease-out;
}

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

.toast.success {
    background: #065f46;
    border: 1px solid #047857;
}

.toast.error {
    background: #991b1b;
    border: 1px solid #b91c1c;
}

.toast.info {
    background: #1e3a8a;
    border: 1px solid #1d4ed8;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .intranet-main {
        margin-top: 120px;
        padding: 20px 3%;
    }
    .header-container {
        flex-direction: column;
        gap: 14px;
    }
    .auth-box {
        padding: 30px 20px;
    }
}
