/* ============================================
   SAMU - Sistema de Controle de Estoque
   Secretaria de Saúde - Prefeitura de Vigia
   Estilos Globais
   ============================================ */

/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #DC1F26;
    --primary-dark: #B71C1C;
    --primary-light: #EF4444;
    --secondary: #F59E0B;
    --secondary-dark: #D97706;
    --secondary-light: #FBBF24;
    --success: #10B981;
    --success-light: #34D399;
    --warning: #F59E0B;
    --warning-light: #FCD34D;
    --danger: #DC1F26;
    --danger-light: #EF4444;
    --info: #3B82F6;
    --info-light: #60A5FA;
    --bg-primary: #F9FAFB;
    --bg-card: #FFFFFF;
    --bg-dark: #1F1F1F;
    --bg-sidebar: #0F0F0F;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --text-white: #FFFFFF;
    --border-color: #E5E7EB;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-xl: 0 12px 36px rgba(0,0,0,0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --sidebar-width: 260px;
    --navbar-height: 64px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    outline: none;
    border: none;
}

/* === SCROLLBAR CUSTOM === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* === LAYOUT === */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-sidebar) 100%);
    color: var(--text-white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 2px solid rgba(220, 31, 38, 0.3);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid rgba(220, 31, 38, 0.5);
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(220, 31, 38, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 4px;
}

.sidebar-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid rgba(220, 31, 38, 0.3);
    padding: 4px;
    box-shadow: 0 4px 12px rgba(220, 31, 38, 0.3);
}

.sidebar-logo .logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-logo h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-header p {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: 0.5px;
}

.sidebar-prefeitura {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-prefeitura-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255,255,255,0.08);
    padding: 3px;
    border: 1px solid rgba(245,158,11,0.3);
}

.sidebar-prefeitura-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-prefeitura-text {
    font-size: 0.85rem;
    color: #F59E0B;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.sidebar-nav .nav-section {
    margin-bottom: 24px;
}

.sidebar-nav .nav-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
    font-weight: 600;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: var(--border-radius-sm);
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    margin-bottom: 2px;
    white-space: nowrap;
}

.sidebar-nav .nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-white);
}

.sidebar-nav .nav-item.active {
    background: var(--primary);
    color: var(--text-white);
    box-shadow: 0 4px 16px rgba(220, 31, 38, 0.5);
}

.sidebar-nav .nav-item .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--border-radius-sm);
    background: rgba(255,255,255,0.05);
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.sidebar-copyright {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    text-align: center;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.4;
}

.sidebar-copyright strong {
    color: #F59E0B;
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

.sidebar-copyright p {
    margin: 0;
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content.expanded {
    margin-left: 0;
}

/* === TOPBAR === */
.topbar {
    height: var(--navbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    border-top: 3px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1100;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1101;
}

.topbar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: 1.25rem;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation;
    pointer-events: auto;
    position: relative;
    z-index: 1102;
    user-select: none;
    -webkit-user-select: none;
}

.topbar-toggle:hover {
    background: var(--bg-primary);
}

.topbar-toggle:active {
    background: var(--bg-primary);
    transform: scale(0.95);
}

.topbar-title h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-title p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-prefeitura {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 16px;
    padding: 6px 12px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.topbar-prefeitura-logo {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(245,158,11,0.2);
}

.topbar-prefeitura-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.topbar-prefeitura-text {
    font-size: 0.85rem;
    color: #F59E0B;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.topbar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-primary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
    position: relative;
}

.topbar-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.topbar-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === PAGE CONTENT === */
.page-content {
    flex: 1;
    padding: 24px;
}

/* === CARDS === */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

/* === STATS CARDS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    border-left: 4px solid transparent;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--primary);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.red { background: rgba(220,31,38,0.12); color: var(--primary); }
.stat-icon.blue { background: rgba(59,130,246,0.12); color: var(--info); }
.stat-icon.green { background: rgba(16,185,129,0.12); color: var(--success); }
.stat-icon.orange { background: rgba(245,158,11,0.12); color: var(--secondary); }
.stat-icon.info { background: rgba(59,130,246,0.12); color: var(--info); }

.stat-info h4 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition);
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(220,31,38,0.5);
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
    box-shadow: 0 4px 16px rgba(245,158,11,0.4);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}

.btn-warning {
    background: var(--secondary);
    color: #fff;
}

.btn-warning:hover {
    background: var(--secondary-dark);
    box-shadow: 0 4px 12px rgba(245,158,11,0.4);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #991B1B;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(220,31,38,0.08);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px;
}

.btn-ghost:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

/* === FORMS === */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: var(--transition);
    font-size: 0.9rem;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(220,31,38,0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.error {
    border-color: var(--danger);
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239E9E9E' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* === TABLES === */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
}

.table td {
    padding: 12px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tr:hover td {
    background: rgba(0,0,0,0.02);
}

.table .actions {
    display: flex;
    gap: 6px;
}

.table .action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition);
    background: transparent;
    color: var(--text-secondary);
}

.table .action-btn:hover {
    background: var(--bg-primary);
}

.table .action-btn.edit:hover {
    color: var(--secondary);
}

.table .action-btn.delete:hover {
    color: var(--danger);
}

/* === BADGES === */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-status.stock-ok {
    background: rgba(46,125,50,0.1);
    color: var(--success);
}

.badge-status.stock-low {
    background: rgba(245,158,11,0.12);
    color: var(--secondary);
}

.badge-status.stock-critical {
    background: rgba(220,31,38,0.12);
    color: var(--danger);
}

.badge-status.badge-blue {
    background: rgba(59,130,246,0.12);
    color: var(--info);
}

.badge-status.badge-green {
    background: rgba(46,125,50,0.1);
    color: var(--success);
}

.badge-status.badge-orange {
    background: rgba(245,158,11,0.12);
    color: var(--secondary);
}

/* === MODALS === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9) translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-primary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    color: #fff;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* === SEARCH BAR === */
.search-bar {
    position: relative;
    max-width: 360px;
    width: 100%;
}

.search-bar input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    font-size: 0.875rem;
}

.search-bar input:focus {
    border-color: var(--primary);
    background: var(--bg-card);
}

.search-bar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* === ALERT/TOAST === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    display: flex;
    pointer-events: auto;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 420px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info { border-color: var(--info); }

.toast .toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast .toast-message {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
}

.toast .toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 360px;
    margin: 0 auto;
}

/* === PAGINATION === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 0;
}

.pagination button {
    min-width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 500;
    background: transparent;
    color: var(--text-secondary);
    transition: var(--transition);
}

.pagination button:hover {
    background: var(--bg-primary);
}

.pagination button.active {
    background: var(--primary);
    color: #fff;
}

/* === LOGIN PAGE === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #0a0a0a 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(220,31,38,0.25) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(245,158,11,0.2) 0%, transparent 70%);
    bottom: -50px;
    left: -50px;
    border-radius: 50%;
}

.login-container {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    padding: 40px 32px;
    position: relative;
    z-index: 1;
    border-top: 4px solid var(--primary);
    border-bottom: 4px solid var(--secondary);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .login-logo {
    width: 120px;
    height: 120px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    overflow: hidden;
    border: 3px solid rgba(220, 31, 38, 0.2);
    padding: 8px;
    box-shadow: 0 8px 32px rgba(220, 31, 38, 0.3), 0 0 60px rgba(245, 158, 11, 0.15);
}

.login-header .login-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.login-prefeitura {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(255,255,255,0.1);
}

.login-prefeitura-logo {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.08);
    padding: 4px;
    border: 2px solid rgba(245,158,11,0.3);
}

.login-prefeitura-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-prefeitura-text {
    font-size: 0.95rem;
    color: #F59E0B;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .input-icon-wrapper {
    position: relative;
}

.login-form .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
}

.login-form .form-control {
    padding-left: 42px;
}

.login-form .password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.login-copyright {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.login-copyright p {
    font-size: 0.8rem;
    color: #F59E0B;
    margin: 0;
    line-height: 1.5;
}

.login-copyright strong {
    color: #F59E0B;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* === FILTER BAR === */
.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.filter-bar .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === TABS === */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* === SIDEBAR OVERLAY (MOBILE) === */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* === CHECKBOX TOGGLE === */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-switch .toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: 12px;
    transition: var(--transition);
}

.toggle-switch .toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* === PERMISSION CHECKBOXES === */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.permission-item:hover {
    border-color: var(--primary);
    background: rgba(220,31,38,0.05);
}

.permission-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

.permission-item label {
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .app-container {
        overflow-x: hidden;
        position: relative;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: var(--sidebar-width);
    }

    .sidebar.active {
        transform: translateX(0) !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1000 !important;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .topbar-toggle {
        display: flex;
        z-index: 1102;
        cursor: pointer;
        position: relative;
        background: rgba(220, 31, 38, 0.8) !important;
        border: 3px solid #FFFFFF !important;
        pointer-events: auto !important;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.4rem;
        box-shadow: 0 0 0 4px rgba(220, 31, 38, 0.3) !important;
    }
    
    .topbar-toggle:active {
        background: var(--primary) !important;
        color: white;
        transform: scale(0.95);
    }

    .sidebar-overlay {
        z-index: 999;
        position: fixed;
    }

    .sidebar-overlay.active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Logo da Prefeitura - Reduzir tamanho em tablets */
    .topbar-prefeitura {
        gap: 6px;
        margin-right: 10px;
        padding: 5px 10px;
    }

    .topbar-prefeitura-logo {
        width: 36px;
        height: 36px;
        border-radius: 5px;
    }

    .topbar-prefeitura-text {
        font-size: 0.75rem;
        letter-spacing: 0.4px;
    }
}

@media (max-width: 768px) {
    :root {
        --navbar-height: 56px;
        font-size: 15px;
    }

    .page-content {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .stat-info h4 {
        font-size: 1.1rem;
    }

    .stat-info p {
        font-size: 0.75rem;
    }

    .card {
        border-radius: 10px;
    }

    .card-header {
        padding: 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .card-header h3 {
        font-size: 1rem;
    }

    .card-body {
        padding: 12px;
    }

    .topbar {
        padding: 0 12px;
    }

    /* MODAL MOBILE OTIMIZADO */
    .modal {
        max-width: 100%;
        width: 100%;
        max-height: 95vh;
        margin: 0;
        border-radius: 20px 20px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }

    .modal-overlay.active .modal {
        transform: translateY(0);
    }

    .modal-header {
        padding: 16px;
        position: sticky;
        top: 0;
        background: var(--bg-card);
        z-index: 10;
    }

    .modal-body {
        padding: 16px;
        max-height: calc(95vh - 140px);
        overflow-y: auto;
    }

    .modal-footer {
        padding: 12px 16px;
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }

    /* FORMULÁRIOS MOBILE */
    .form-control, .form-select {
        min-height: 48px;
        font-size: 16px; /* Evita zoom no iOS */
        padding: 12px 16px;
        border-radius: 10px;
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* BOTÕES MOBILE */
    .btn {
        min-height: 46px;
        padding: 12px 20px;
        font-size: 0.95rem;
        border-radius: 10px;
        font-weight: 600;
    }

    .btn-sm {
        min-height: 38px;
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    /* FILTROS MOBILE */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .search-bar {
        max-width: 100%;
    }

    .search-bar input {
        height: 44px;
        font-size: 16px;
    }

    /* TABELAS MOBILE - SCROLL HORIZONTAL */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px; /* Extend to edges */
        padding: 0 12px;
    }

    .table {
        min-width: 600px;
    }

    .table td, .table th {
        padding: 12px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* CARDS ALTERNATIVOS PARA LISTAS */
    .mobile-card-list {
        display: block;
    }

    .mobile-card-item {
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 14px;
        margin-bottom: 10px;
    }

    .mobile-card-item:active {
        background: var(--bg-primary);
    }

    /* PERMISSÕES GRID */
    .permissions-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* LOGIN MOBILE */
    .login-container {
        padding: 28px 20px;
        max-width: 100%;
    }

    .login-logo {
        width: 100px;
        height: 100px;
    }

    /* ACTIONS MOBILE */
    .card-actions {
        flex-direction: column;
        width: 100%;
    }

    .card-actions .btn {
        width: 100%;
    }

    /* Logo da Prefeitura - Reduzir tamanho no mobile */
    .topbar-prefeitura {
        gap: 6px;
        margin-right: 8px;
        padding: 4px 8px;
    }

    .topbar-prefeitura-logo {
        width: 32px;
        height: 32px;
        border-radius: 4px;
    }

    .topbar-prefeitura-text {
        font-size: 0.65rem;
        letter-spacing: 0.3px;
        line-height: 1.2;
    }
}

@media (max-width: 480px) {
    :root {
        font-size: 14px;
    }

    .page-content {
        padding: 10px;
    }

    /* STATS EM COLUNA ÚNICA PARA TELAS MUITO PEQUENAS */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        gap: 12px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
    }

    /* MODAIS FULLSCREEN */
    .modal {
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }

    .modal-header {
        padding: 12px;
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 12px;
        max-height: calc(100vh - 120px);
    }

    .modal-footer {
        padding: 10px 12px;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }

    /* FORMULÁRIOS EXTRA MOBILE */
    .form-control, .form-select {
        font-size: 16px; /* Evita zoom automático */
        min-height: 50px;
        padding: 14px;
    }

    textarea.form-control {
        min-height: 100px;
    }

    /* BOTÕES GRANDES PARA TOUCH */
    .btn {
        min-height: 48px;
        font-size: 1rem;
        padding: 14px 20px;
        border-radius: 12px;
    }

    .btn-sm {
        min-height: 40px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    /* TABELAS COMPACTAS */
    .table {
        font-size: 0.8rem;
        min-width: 550px;
    }

    .table td, .table th {
        padding: 10px 8px;
    }

    /* TOPBAR MOBILE */
    .topbar {
        padding: 0 10px;
    }

    .topbar-title h1 {
        font-size: 0.95rem;
        font-weight: 700;
    }

    .topbar-title p {
        display: none;
    }

    .topbar-user span {
        display: none;
    }

    /* SIDEBAR MOBILE */
    .sidebar {
        width: 280px;
        z-index: 1000;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
    }

    .sidebar.active {
        transform: translateX(0) !important;
        display: flex !important;
        visibility: visible !important;
    }

    .topbar-toggle {
        min-width: 44px;
        min-height: 44px;
        font-size: 1.4rem;
    }

    /* CARDS COMPACTOS */
    .card-header {
        padding: 12px;
    }

    .card-body {
        padding: 10px;
    }

    /* BADGES E STATUS */
    .badge-status {
        font-size: 0.7rem;
        padding: 4px 8px;
    }

    /* INPUTS COM ÍCONES */
    .input-icon-wrapper {
        position: relative;
    }

    .input-icon-wrapper .input-icon {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.1rem;
        z-index: 1;
    }

    .input-icon-wrapper .form-control {
        padding-left: 46px;
    }

    /* CHECKBOX E RADIO MAIORES */
    .checkbox-label input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
    }

    .checkbox-label {
        padding: 12px;
        min-height: 48px;
    }

    /* FAB BUTTON PARA ADICIONAR */
    .fab-button {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--primary);
        color: white;
        font-size: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(220, 31, 38, 0.4);
        z-index: 999;
        transition: var(--transition);
    }

    .fab-button:active {
        transform: scale(0.95);
    }

    /* MENSAGENS DE ERRO */
    .form-error {
        font-size: 0.8rem;
        padding: 8px;
        margin-top: 6px;
    }

    /* TOAST MOBILE */
    .toast-container {
        bottom: 20px;
        right: 10px;
        left: 10px;
        width: auto;
        pointer-events: none;
    }

    .toast {
        width: 100%;
        font-size: 0.9rem;
        pointer-events: auto;
    }

    /* SELECT CUSTOMIZADO */
    select.form-select {
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px center;
        padding-right: 40px;
    }
}

/* === LANDSCAPE MOBILE === */
@media (max-width: 896px) and (orientation: landscape) {
    .modal {
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-body {
        max-height: calc(90vh - 120px);
    }

    .page-content {
        padding: 10px;
    }

    /* Logo da Prefeitura - Ainda menor em telas muito pequenas */
    .topbar-prefeitura {
        gap: 4px;
        margin-right: 6px;
        padding: 3px 6px;
    }

    .topbar-prefeitura-logo {
        width: 28px;
        height: 28px;
        border-radius: 3px;
    }

    .topbar-prefeitura-text {
        font-size: 0.6rem;
        letter-spacing: 0.2px;
    }
}

/* === TOUCH IMPROVEMENTS === */
@media (hover: none) and (pointer: coarse) {
    /* Aumentar áreas de toque */
    button, a, .btn, .nav-item {
        min-height: 44px;
    }

    .table tbody tr {
        cursor: pointer;
    }

    .table tbody tr:active {
        background: var(--bg-primary);
    }

    /* Remover hover effects em touch */
    .btn:hover,
    .nav-item:hover {
        transform: none;
    }

    /* Feedback visual em touch */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .nav-item:active {
        background: rgba(255, 255, 255, 0.15);
    }
}

/* === PRINT === */
@media print {
    .sidebar, .topbar, .modal-overlay, .toast-container {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* === UTILITY CLASSES === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

/* === MOBILE SPECIFIC IMPROVEMENTS === */

/* Input Number Buttons Mobile */
@media (max-width: 768px) {
    .input-number-wrapper {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .input-number-wrapper input[type="number"] {
        text-align: center;
        font-size: 1.1rem;
        font-weight: 600;
    }

    .input-number-wrapper button {
        width: 44px;
        height: 44px;
        border-radius: 8px;
        background: var(--primary);
        color: white;
        font-size: 1.2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .input-number-wrapper button:active {
        transform: scale(0.95);
    }
}

/* Mobile Card View for Products */
@media (max-width: 768px) {
    .product-mobile-card {
        background: white;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 14px;
        margin-bottom: 12px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        box-shadow: var(--shadow-sm);
    }

    .product-mobile-card:active {
        background: var(--bg-primary);
        transform: scale(0.99);
    }

    .product-mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
    }

    .product-mobile-title {
        flex: 1;
        font-weight: 600;
        font-size: 0.95rem;
        color: var(--text-primary);
    }

    .product-mobile-quantity {
        font-size: 1.2rem;
        font-weight: 700;
        color: var(--primary);
        white-space: nowrap;
    }

    .product-mobile-info {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        font-size: 0.8rem;
    }

    .product-mobile-info-item {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .product-mobile-info-label {
        color: var(--text-muted);
        font-size: 0.75rem;
    }

    .product-mobile-info-value {
        color: var(--text-primary);
        font-weight: 500;
    }

    .product-mobile-actions {
        display: flex;
        gap: 8px;
        margin-top: 6px;
    }

    .product-mobile-actions .btn {
        flex: 1;
        padding: 10px;
        font-size: 0.85rem;
    }
}

/* Quick Action Buttons Mobile */
@media (max-width: 768px) {
    .quick-actions-mobile {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }

    .quick-action-btn {
        background: var(--bg-card);
        border: 2px solid var(--border-color);
        border-radius: 12px;
        padding: 16px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        text-align: center;
        transition: var(--transition);
        min-height: 100px;
        color: var(--text-primary);
    }

    .quick-action-btn:active {
        transform: scale(0.97);
        border-color: var(--primary);
        background: var(--bg-primary);
    }

    .quick-action-btn .icon {
        font-size: 2rem;
    }

    .quick-action-btn .label {
        font-size: 0.85rem;
        font-weight: 600;
    }
}

/* Bottom Sheet Style Modal */
@media (max-width: 768px) {
    .modal-overlay {
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(2px);
    }

    .modal {
        animation: slideUp 0.3s ease-out;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    /* Handle visual para arrastar modal */
    .modal-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--border-color);
        border-radius: 2px;
    }

    .modal-header {
        padding-top: 24px;
    }
}

/* Floating Labels for Better UX */
@media (max-width: 768px) {
    .form-group-floating {
        position: relative;
        margin-bottom: 20px;
    }

    .form-group-floating input,
    .form-group-floating select,
    .form-group-floating textarea {
        width: 100%;
        padding: 16px 14px 8px;
        border: 2px solid var(--border-color);
        border-radius: 10px;
        font-size: 16px;
        transition: var(--transition);
    }

    .form-group-floating input:focus,
    .form-group-floating select:focus,
    .form-group-floating textarea:focus {
        border-color: var(--primary);
    }

    .form-group-floating label {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 16px;
        color: var(--text-muted);
        pointer-events: none;
        transition: var(--transition);
        background: white;
        padding: 0 4px;
    }

    .form-group-floating input:focus + label,
    .form-group-floating input:not(:placeholder-shown) + label,
    .form-group-floating select:focus + label,
    .form-group-floating select:not([value=""]) + label,
    .form-group-floating textarea:focus + label,
    .form-group-floating textarea:not(:placeholder-shown) + label {
        top: 0;
        font-size: 0.75rem;
        color: var(--primary);
    }
}

/* Swipe Actions */
@media (max-width: 768px) {
    .swipeable-item {
        position: relative;
        touch-action: pan-y;
    }

    .swipe-actions {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 0 8px;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .swipeable-item.swiped .swipe-actions {
        transform: translateX(0);
    }

    .swipe-action-btn {
        width: 48px;
        height: 48px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        color: white;
    }

    .swipe-action-btn.edit {
        background: var(--info);
    }

    .swipe-action-btn.delete {
        background: var(--danger);
    }
}

/* Pull to Refresh Indicator */
@media (max-width: 768px) {
    .pull-refresh-indicator {
        position: fixed;
        top: var(--navbar-height);
        left: 50%;
        transform: translateX(-50%) scale(0);
        width: 40px;
        height: 40px;
        background: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: var(--shadow-md);
        z-index: 1000;
        transition: transform 0.3s ease;
    }

    .pull-refresh-indicator.active {
        transform: translateX(-50%) scale(1);
    }

    .pull-refresh-indicator::after {
        content: '↻';
        font-size: 1.5rem;
        animation: spin 1s linear infinite;
    }

    @keyframes spin {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
    }
}

/* Mobile Keyboard Spacing */
@media (max-width: 768px) {
    body.keyboard-open {
        height: 100vh;
        overflow: hidden;
    }

    body.keyboard-open .modal {
        max-height: 60vh;
    }

    body.keyboard-open .modal-body {
        max-height: calc(60vh - 120px);
    }
}

/* Safe Area for Notched Phones */
@supports (padding: max(0px)) {
    .page-content {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .topbar {
        padding-top: env(safe-area-inset-top);
    }

    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }

    @media (max-width: 768px) {
        .modal {
            padding-bottom: max(0px, env(safe-area-inset-bottom));
        }

        .fab-button {
            bottom: max(20px, calc(20px + env(safe-area-inset-bottom)));
            right: max(20px, calc(20px + env(safe-area-inset-right)));
        }
    }
}
