:root {
    --apple-gray: #f5f5f7;
    --apple-blue: #007aff;
    --apple-dark: #1d1d1f;
    --apple-text: #1d1d1f;
    --apple-secondary: #86868b;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
}

/* Login */
.login-body {
    background: linear-gradient(135deg, #f5f5f7 0%, #e5e5e7 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    border: none;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    background: white;
}

.login-card .card-header {
    background: linear-gradient(135deg, var(--apple-dark), #424245);
    color: white;
    padding: 30px;
    border: none;
}

/* Header Mobile */
.mobile-header {
    display: none;
    background: var(--apple-dark);
    color: #fff;
    padding: 12px 16px;
    align-items: center;
    justify-content: space-between;
}

.hamburger-menu {
    background: transparent;
    border: 0;
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.hamburger-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.hamburger-menu.active .hamburger-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger-menu.active .hamburger-bar:nth-child(2) { opacity: 0; }
.hamburger-menu.active .hamburger-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    z-index: 900;
}

/* Dashboard */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Sidebar */
/* Sidebar desativada (menu inferior em uso) */
.sidebar { display: none; }

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h5 {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.menu-item a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.menu-item a:hover {
    background: rgba(255,255,255,0.1);
}

.menu-item.active a {
    background: var(--apple-blue);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    position: absolute;
    bottom: 0;
    width: 100%;
}

.user-credits {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 8px;
}

.credits-info {
    margin-right: 15px;
}

.credits-badge {
    background: linear-gradient(135deg, var(--apple-blue), #0056b3);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
    display: inline-flex;
    align-items: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 0;
    transition: all 0.3s ease;
    padding-bottom: 64px; /* espaço para a bottom nav */
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.content-header {
    background: white;
    padding: 20px;
    border-bottom: 1px solid #e5e5e7;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-body {
    padding: 20px;
    background: var(--apple-gray);
    min-height: calc(100vh - 80px);
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-header {
    background: white;
    border-bottom: 1px solid #e5e5e7;
    padding: 15px 20px;
}

.card-header h5 {
    margin: 0;
    display: flex;
    align-items: center;
}

.stat-card {
    text-align: center;
}

.stat-card .stat-icon {
    font-size: 2rem;
    color: var(--apple-blue);
    margin-bottom: 10px;
}

.stat-card h3 {
    margin: 0;
    font-size: 2.5rem;
    color: var(--apple-dark);
}

.stat-card p {
    margin: 5px 0 0 0;
    color: var(--apple-secondary);
}

/* Formulários */
.form-label {
    font-weight: 600;
    color: var(--apple-text);
    margin-bottom: 8px;
    font-size: 1rem;
}

.form-control {
    border: 2px solid #e5e5e7;
    border-radius: 12px;
    padding: 12px 15px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--apple-gray);
}

.form-control:focus {
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 0.2rem rgba(0, 122, 255, 0.25);
    background: white;
}

.btn-primary {
    background: linear-gradient(135deg, var(--apple-blue), #0056b3);
    border: none;
    border-radius: 12px;
    padding: 12px 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
}

.btn-send {
    background: linear-gradient(135deg, var(--apple-blue), #0056b3);
    border: none;
    border-radius: 15px;
    padding: 15px 40px;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

.btn-send:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.4);
}

/* Alertas */
.alert {
    border: none;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-left: 4px solid #34c759;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left: 4px solid #ff3b30;
}

/* Preview da mensagem */
.message-preview {
    background: #f5f5f7;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid #e5e5e7;
}

/* Editor de Template */
.template-editor {
    background: #f5f5f7;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid #e5e5e7;
}

.template-editor h6 {
    color: var(--apple-text);
    margin-bottom: 15px;
    font-weight: 600;
}

.template-editor .form-label {
    font-weight: 600;
    color: var(--apple-text);
    margin-bottom: 8px;
}

.template-editor textarea {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 200px;
}

.template-editor .form-text {
    background: white;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    border: 1px solid #e5e5e7;
    font-size: 0.85rem;
}

.template-editor code {
    background: var(--apple-gray);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--apple-blue);
    font-weight: 600;
}

.message-content {
    background: white;
    border-radius: 8px;
    padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    border: 1px solid #e5e5e7;
}

.apple-emoji {
    font-size: 1.2em;
}

.image-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-top: 10px;
}

/* Tabelas */
.table th {
    border-top: none;
    font-weight: 600;
    color: var(--apple-text);
}

/* Tabelas responsivas e formulários em telas pequenas */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table td, .table th {
    white-space: nowrap;
}

form .row > [class^="col-"],
form .row > [class*=" col-"] {
    margin-bottom: 12px;
}

.form-text {
    font-size: 0.85rem;
}

/* Responsividade */
@media (max-width: 991.98px) {
.mobile-header { display: none; }
    .sidebar { display: none; }
    
    .sidebar-header h5 {
        display: none;
    }
    
    .menu-item a span {
        display: none;
    }
    
    .menu-item a {
        justify-content: center;
        padding: 15px;
    }
    
    .menu-item a i {
        margin-right: 0;
        font-size: 1.2rem;
    }
    
    .main-content { margin-left: 0; }
    
    .sidebar.collapsed { display: none; }
    .sidebar:not(.collapsed) { display: none; }
    
    .content-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .table td, .table th {
        white-space: normal;
    }

    .card-body,
    .content-body {
        padding: 12px;
    }

    .form-control {
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.95rem;
    }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 56px !important;
    background: #ffffff !important;
    border-top: 1px solid #e5e5e7 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-around !important;
    z-index: 1100 !important;
    padding: 8px 0 !important;
}

.bottom-nav a {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: var(--apple-dark) !important;
    text-decoration: none !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    flex-direction: column !important;
    text-align: center !important;
    min-width: 60px !important;
}

.bottom-nav a.active,
.bottom-nav a:hover {
    background: var(--apple-gray) !important;
    color: var(--apple-blue) !important;
}

@media (max-width: 575.98px) {
    .bottom-nav a span { 
        display: inline-block !important; 
        font-size: 0.7rem !important;
        margin-top: 2px !important;
    }
}

@media (max-width: 576px) {
    .login-container {
        padding: 10px;
    }
    
    .content-body {
        padding: 15px;
    }
    
    .btn-send {
        width: 100%;
        padding: 12px 20px;
    }
}