/* ============================================
   FLOWSTATE - MODERN UI THEME
   Design inspirado em dashboards modernos
   Tema Claro (padrão) + Tema Escuro (toggle)
   ============================================ */

:root {
    /* Cores Principais - Light Theme (Padrão) */
    --primary-bg: #f8fafc;
    --secondary-bg: #ffffff;
    --card-bg: #ffffff;
    --card-hover: #ffffff;
    
    /* Cor Principal (Indigo) */
    --primary-color: #4f46e5;
    --primary-light: #eef2ff;
    --primary-hover: #4338ca;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --gradient-info: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    --gradient-card: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    
    /* Bordas e Backgrounds */
    --glass-bg: #f8fafc;
    --glass-border: #e2e8f0;
    --border-color: #e2e8f0;
    
    /* Cores de Texto */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* Sombras Suaves */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    
    /* Espaçamentos */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Transições */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ============================================
   TEMA ESCURO (Dark Mode)
   ============================================ */

body.dark-mode {
    --primary-bg: #0f1419;
    --secondary-bg: #1a1f2e;
    --card-bg: rgba(26, 31, 46, 0.8);
    --card-hover: rgba(26, 31, 46, 0.95);
    
    --primary-color: #667eea;
    --primary-light: rgba(102, 126, 234, 0.2);
    --primary-hover: #764ba2;
    
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-warning: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-info: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-card: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --border-color: rgba(255, 255, 255, 0.1);
    
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);
}

body.dark-mode::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 50%);
    animation: rotate 20s linear infinite;
    z-index: 0;
    pointer-events: none;
}

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

body.dark-mode .sidebar {
    background: rgba(26, 31, 46, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

body.dark-mode .glass-card {
    background: rgba(26, 31, 46, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

body.dark-mode .stat-card {
    background: rgba(26, 31, 46, 0.8);
    backdrop-filter: blur(20px);
}

body.dark-mode .nav-link {
    color: #a0aec0;
}

body.dark-mode .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    transform: translateX(5px);
}

body.dark-mode .nav-link.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

body.dark-mode .form-control {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

body.dark-mode .form-control::placeholder {
    color: #718096;
}

body.dark-mode .btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .search-input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

body.dark-mode .user-avatar {
    background: var(--gradient-primary);
    color: white;
}

body.dark-mode .stat-icon {
    color: white;
}

body.dark-mode .stat-change.positive {
    color: #38ef7d;
    background: rgba(56, 239, 125, 0.1);
}

body.dark-mode .stat-change.negative {
    color: #f5576c;
    background: rgba(245, 87, 108, 0.1);
}

body.dark-mode .header-title {
    color: #ffffff;
}

body.dark-mode .text-secondary {
    color: #a0aec0;
}

body.dark-mode .stat-label {
    color: #a0aec0;
}

body.dark-mode .stat-value {
    color: #ffffff;
}

body.dark-mode .form-label {
    color: #a0aec0;
}

body.dark-mode .accessibility-controls button {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

body.dark-mode .accessibility-controls button:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================
   RESET E BASE
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */

.main-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--secondary-bg);
    border-right: 1px solid var(--border-color);
    padding: var(--spacing-md);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform var(--transition-base);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: var(--radius-full);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: white;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Menu de Navegação */
.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: var(--spacing-xs);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    color: #64748b;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    font-weight: 500;
    font-size: 0.875rem;
}

.nav-link:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary-color);
}

.nav-link i {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
    color: inherit;
}

/* Content Area */
.content-area {
    flex: 1;
    margin-left: 260px;
    padding: var(--spacing-lg);
    background: var(--primary-bg);
}

/* ============================================
   HEADER
   ============================================ */

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-sm) 0;
    background: var(--secondary-bg);
    border-bottom: 1px solid var(--border-color);
    margin: calc(-1 * var(--spacing-lg));
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-sm) var(--spacing-lg);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.header-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

/* Search Bar */
.search-bar {
    position: relative;
}

.search-input {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    color: var(--text-primary);
    width: 250px;
    font-size: 0.875rem;
    transition: all var(--transition-base);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.search-input::placeholder {
    color: #94a3b8;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
}

.user-menu:hover {
    background: #f1f5f9;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* ============================================
   CARDS
   ============================================ */

.glass-card {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
}

.card-gradient {
    position: relative;
    overflow: hidden;
}

.card-gradient::before {
    display: none;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-sm);
}

.stat-card {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    display: none;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
}

.stat-label {
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.stat-icon.primary {
    background: var(--primary-color);
}

.stat-icon.success {
    background: #10b981;
}

.stat-icon.warning {
    background: #f59e0b;
}

.stat-icon.info {
    background: #3b82f6;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin-top: 0.25rem;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

.stat-change.positive {
    color: #10b981;
}

.stat-change.negative {
    color: #ef4444;
}

/* ============================================
   BOTÕES
   ============================================ */

.btn-modern {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    color: #475569;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--secondary-bg);
    border: 1px solid #d1d5db;
    border-radius: var(--radius-md);
    color: #1e293b;
    font-size: 0.875rem;
    transition: all var(--transition-base);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.form-control::placeholder {
    color: #94a3b8;
}

/* ============================================
   ANIMAÇÕES
   ============================================ */

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

.fade-in {
    animation: fadeIn var(--transition-base) ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn var(--transition-base) ease-out;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet Landscape */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        z-index: 1000;
        box-shadow: var(--shadow-xl);
        width: 260px;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .content-area {
        margin-left: 0;
        width: 100%;
    }
    
    .content-header {
        margin: calc(-1 * var(--spacing-lg));
        margin-bottom: var(--spacing-lg);
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .header-actions {
        gap: 0.5rem;
    }
}

/* Tablet Portrait */
@media (max-width: 768px) {
    .content-area {
        padding: var(--spacing-sm);
    }
    
    .content-header {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin: calc(-1 * var(--spacing-sm));
        margin-bottom: var(--spacing-sm);
        padding: var(--spacing-sm);
    }
    
    .header-title {
        font-size: 1.125rem;
        width: 100%;
        order: -1;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: var(--spacing-sm);
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .search-bar {
        display: none;
    }
    
    .glass-card {
        padding: var(--spacing-sm);
    }
    
    .accessibility-controls button {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .form-control {
        font-size: 16px; /* Previne zoom no iOS */
    }
}

/* Mobile Large (iPhone Plus, etc) */
@media (max-width: 576px) {
    .content-area {
        padding: 0.75rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .header-actions {
        justify-content: flex-start;
    }
    
    .accessibility-controls {
        order: 2;
    }
    
    .user-menu {
        order: 3;
    }
    
    .user-menu span {
        display: none;
    }
    
    .nav-menu {
        padding: 0;
    }
    
    .nav-link {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .btn-modern {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        width: 100%;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
}

/* Mobile Small (iPhone SE, etc) */
@media (max-width: 375px) {
    .content-area {
        padding: 0.5rem;
    }
    
    .content-header {
        padding: 0.5rem;
    }
    
    .header-title {
        font-size: 1rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .accessibility-controls button {
        padding: 0.25rem 0.4rem;
        font-size: 0.7rem;
    }
    
    .glass-card {
        padding: 0.75rem;
        border-radius: var(--radius-md);
    }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    cursor: pointer;
    font-size: 1.25rem;
    z-index: 1001;
}

@media (max-width: 1024px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .content-header {
        padding-top: 3.5rem;
    }
}

/* Overlay for mobile menu */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Language selector mobile */
@media (max-width: 576px) {
    form[action*="set_language"] select {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        max-width: 80px;
    }
}

/* ============================================
   UTILITÁRIOS
   ============================================ */

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glow {
    box-shadow: var(--shadow-glow);
}

.blur-bg {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* ============================================
   SUBSCRIPTION STATUS BADGES (Profile)
   ============================================ */

.subscription-status {
    margin-bottom: 1rem;
}

.subscription-actions {
    margin-top: 1rem;
}

.subscription-actions .mt-2 {
    margin-top: 0.5rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
}

.status-badge i {
    font-size: 0.875rem;
}

.status-trial {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    color: white;
}

.status-active {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: white;
}

.status-grace {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: white;
}

.status-expired {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    color: white;
}

.status-cancelled {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    color: white;
}

.status-inactive {
    background: var(--glass-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.card-header-primary {
    background: var(--gradient-primary);
    color: white;
}
