/**
 * theme.css
 * Variáveis de tema e estilos base para o UDNSTC FileManager
 * @version 2.0.0
 */

/* ========== CSS Reset & Base ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== CSS Variables ========== */
:root {
    /* Colors - Light Theme */
    --primary: #0066ff;
    --primary-hover: #0052cc;
    --primary-light: #e6f0ff;
    --primary-dark: #0047b3;
    
    --secondary: #6c757d;
    --secondary-hover: #545b62;
    --secondary-light: #e9ecef;
    
    --success: #10b981;
    --success-hover: #059669;
    --success-light: #d1fae5;
    
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fee2e2;
    
    --warning: #f59e0b;
    --warning-hover: #d97706;
    --warning-light: #fef3c7;
    
    --info: #3b82f6;
    --info-hover: #2563eb;
    --info-light: #dbeafe;
    
    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-hover: #f1f5f9;
    --bg-elevated: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    /* Text */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-inverse: #ffffff;
    
    /* Borders */
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --border-hover: #d1d5db;
    --border-focus: var(--primary);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border radius */
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #4d94ff;
    --primary-hover: #6ba3ff;
    --primary-light: rgba(77, 148, 255, 0.1);
    --primary-dark: #3b82f6;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    --bg-elevated: #1e293b;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    
    --border-color: #334155;
    --border-light: #1e293b;
    --border-hover: #475569;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

/* ========== Global Styles ========== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
    transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* ========== Typography ========== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

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

a:hover {
    color: var(--primary-hover);
}

/* ========== Utility Classes ========== */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

/* ========== Animations ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

/* ========== Scrollbar Styles ========== */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: var(--radius-full);
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--border-hover);
}

/* ========== Selection ========== */
::selection {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

::-moz-selection {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

/* ========== Login Page Base ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

/* Background Pattern */
.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, var(--primary-light) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, var(--info-light) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, var(--success-light) 0%, transparent 50%);
    opacity: 0.3;
    z-index: 0;
}

/* ========== Theme Switcher ========== */
.theme-switcher {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 100;
}

.theme-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-md);
}

.theme-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* ========== Login Container ========== */
.login-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ========== Login Box (Left Side) ========== */
.login-box {
    flex: 1;
    padding: var(--spacing-2xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 600px;
}

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

/* ========== Logo com Imagem ========== */
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    position: relative;
}

.logo-img {
    max-width: 200px;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform var(--transition);
    filter: invert(1) hue-rotate(90deg) brightness(0.1) contrast(1.2);
}

.logo-img:hover {
    transform: scale(1.05);
}

/* Badge de versão */
.version-badge {
    position: absolute;
    top: -5px;
    right: -40px;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

/* Ajuste para tema escuro */
[data-theme="dark"] .logo-img {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) brightness(1.1);
}

/* Responsivo */
@media (max-width: 640px) {
    .logo-img {
        max-width: 150px;
        max-height: 60px;
    }
    
    .version-badge {
        top: -3px;
        right: -30px;
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Caso queira usar diferentes logos para tema claro/escuro */
/*
[data-theme="light"] .logo-img {
    content: url('<?= ROOT ?>public/recb/assets/img/logo-light.png');
}

[data-theme="dark"] .logo-img {
    content: url('<?= ROOT ?>public/recb/assets/img/logo-dark.png');
}
*/

.logo i {
    font-size: 3rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: var(--spacing-sm);
}

/* ========== Login Form ========== */
.login-form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.form-control:hover {
    border-color: var(--border-hover);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background-color: var(--bg-primary);
}

/* Password Input Wrapper */
.password-input-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.25rem;
    transition: color var(--transition);
}

.toggle-password:hover {
    color: var(--text-secondary);
}

/* Form Options */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
}

/* Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    width: 1.25rem;
    height: 1.25rem;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-right: var(--spacing-sm);
    transition: all var(--transition);
    position: relative;
}

.checkbox-container:hover .checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark::after {
    display: block;
}

.checkbox-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.forgot-password {
    font-size: 0.875rem;
    color: var(--primary);
    transition: color var(--transition);
}

.forgot-password:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Login Button */
.btn-login {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-login:hover::before {
    width: 300px;
    height: 300px;
}

.btn-login.loading {
    color: transparent;
}

.btn-login.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

/* Login Footer */
.login-footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

/* ========== Login Side Panel (Right Side) ========== */
.login-side {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: var(--spacing-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Side panel pattern */
.login-side::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 20px,
        rgba(255, 255, 255, 0.05) 20px,
        rgba(255, 255, 255, 0.05) 40px
    );
    animation: slide 20s linear infinite;
}

@keyframes slide {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.side-content {
    position: relative;
    z-index: 1;
    color: white;
}

.side-content h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-2xl);
    color: white;
}

.features {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.feature {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.feature i {
    font-size: 1.5rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.feature h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: white;
}

.feature p {
    font-size: 0.875rem;
    opacity: 0.85;
    line-height: 1.6;
    margin: 0;
}

/* ========== Loading Overlay ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

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

/* ========== Alerts ========== */
.alert {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    border-radius: var(--radius);
    font-size: 0.875rem;
    animation: slideIn var(--transition-slow);
    border: 1px solid;
}

.alert-success {
    color: #065f46;
    background-color: var(--success-light);
    border-color: #34d399;
}

.alert-error {
    color: #991b1b;
    background-color: var(--danger-light);
    border-color: #f87171;
}

.alert-warning {
    color: #92400e;
    background-color: var(--warning-light);
    border-color: #fbbf24;
}

.alert-info {
    color: #1e40af;
    background-color: var(--info-light);
    border-color: #60a5fa;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .login-container {
        flex-direction: column;
        max-width: 500px;
    }
    
    .login-side {
        display: none;
    }
    
    .login-box {
        padding: var(--spacing-xl);
    }
}

@media (max-width: 640px) {
    .login-page {
        padding: var(--spacing-md);
    }
    
    .login-container {
        border-radius: var(--radius-lg);
    }
    
    .login-box {
        padding: var(--spacing-lg);
        min-height: auto;
    }
    
    .logo i {
        font-size: 2.5rem;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .theme-switcher {
        top: var(--spacing-md);
        right: var(--spacing-md);
    }
}