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

:root {
    --bg-main: #0b0f19;
    --bg-card: #151d30;
    --bg-input: #1f2a45;
    --border-color: #2b3a5c;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #d946ef;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --font-sans: 'Outfit', sans-serif;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 60px;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Glassmorphism Header */
header {
    background: rgba(21, 29, 48, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 20px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 15px;
    color: var(--text-muted);
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-main);
    background: rgba(99, 102, 241, 0.12);
}

.nav-link.active {
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Layout Container */
main {
    max-width: 1400px;
    margin: 32px auto 0 auto;
    padding: 0 24px;
}

/* Grid & Layout Utilities */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

/* Card Styles */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-main);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.35);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Metrics Cards */
.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.metric-card.success::before { background: var(--success); }
.metric-card.warning::before { background: var(--warning); }
.metric-card.danger::before { background: var(--danger); }

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.metric-details {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #f43f5e);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.45);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 15px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    text-align: left;
}

.table th {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.table tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-primary { background: rgba(99, 102, 241, 0.15); color: var(--primary); border: 1px solid rgba(99, 102, 241, 0.3); }

/* Kanban Board for Pedidos */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    align-items: start;
}

.kanban-column {
    background-color: #0e1422;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.column-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-count {
    background-color: var(--bg-card);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.order-cards-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 200px;
}

.order-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.order-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.order-code {
    font-weight: 700;
    font-size: 16px;
}

.order-time {
    font-size: 12px;
    color: var(--text-muted);
}

.order-body {
    font-size: 14px;
    margin-bottom: 16px;
}

.order-detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.order-label {
    color: var(--text-muted);
}

.order-value {
    font-weight: 500;
}

.order-notes {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.04);
    padding: 8px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    border-left: 2px solid var(--primary);
    color: #e2e8f0;
}

.order-footer {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

/* Flash Messages */
.messages-container {
    max-width: 1400px;
    margin: 20px auto 0 auto;
    padding: 0 24px;
}

.message {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-success {
    background-color: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.message-warning {
    background-color: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.message-error {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

/* Modal Simple Fallback & Styling */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Navigation Dropdown styling */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.nav-dropdown-trigger i.chevron {
    font-size: 11px;
    transition: var(--transition);
}

.nav-dropdown:hover .nav-dropdown-trigger i.chevron,
.nav-dropdown.active .nav-dropdown-trigger i.chevron {
    transform: rotate(180deg);
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: rgba(21, 29, 48, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-main);
    padding: 8px;
    z-index: 200;
    margin-top: 6px;
    animation: fadeIn 0.2s ease;
}

.nav-dropdown:hover .nav-dropdown-content,
.nav-dropdown.active .nav-dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-dropdown-content::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    width: 100%;
    height: 12px;
    background: transparent;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    color: var(--text-muted);
    transition: var(--transition);
    white-space: nowrap;
}

.nav-dropdown-item:hover, .nav-dropdown-item.active {
    color: var(--text-main);
    background: rgba(99, 102, 241, 0.12);
}

.nav-dropdown-item.active {
    border-left: 3px solid var(--primary);
}

/* Form Responsive Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Header and Navigation Default Desktop Styles */
.caixa-status-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-and-profile {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-profile-dropdown {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-left: 20px;
    border-left: 1px solid var(--border-color);
}

.user-profile-trigger {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-profile-trigger .chevron {
    font-size: 10px;
    color: var(--text-muted);
    transition: var(--transition);
}

.user-profile-dropdown:hover .user-profile-trigger .chevron,
.user-profile-dropdown.active .user-profile-trigger .chevron {
    transform: rotate(180deg);
}

.user-profile-trigger:hover .username,
.user-profile-dropdown.active .username,
.user-profile-dropdown.active-dropdown .username {
    color: var(--primary-light, #818cf8);
}

.user-profile-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: rgba(21, 29, 48, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-main);
    padding: 8px;
    z-index: 200;
    margin-top: 6px;
    animation: fadeIn 0.2s ease;
}

.user-profile-content::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    width: 100%;
    height: 12px;
    background: transparent;
}

.user-profile-dropdown:hover .user-profile-content,
.user-profile-dropdown.active .user-profile-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    color: var(--text-muted);
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.profile-dropdown-item:hover, .profile-dropdown-item.active {
    color: var(--text-main);
    background: rgba(99, 102, 241, 0.12);
}

.profile-dropdown-item.active {
    border-left: 3px solid var(--primary);
}

.profile-dropdown-item.text-danger {
    color: var(--danger);
}

.profile-dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #f43f5e;
}

.user-info {
    text-align: right;
}

.username {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    display: block;
}

.role {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
}

.btn-logout {
    padding: 6px 12px;
    font-size: 12px;
    height: 32px;
    border-radius: var(--radius-sm);
}

/* Responsive and Mobile Navigation Styling */
.mobile-menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .header-container {
        padding: 14px 20px;
    }
    
    .caixa-status-container {
        flex-grow: 1;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .nav-and-profile {
        position: fixed;
        top: 0;
        right: -300px;
        width: 280px;
        height: 100vh;
        background: rgba(21, 29, 48, 0.96);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-left: 1px solid var(--border-color);
        padding: 80px 24px 40px 24px;
        display: flex;
        flex-direction: column;
        gap: 30px;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 150;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    }
    
    .nav-and-profile.active {
        right: 0;
    }
    
    .nav-links {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }
    
    .nav-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        font-size: 16px;
        width: 100%;
    }
    
    .nav-dropdown {
        width: 100%;
    }
    
    .nav-dropdown-trigger {
        width: 100%;
        justify-content: space-between;
    }
    
    .nav-dropdown-content {
        position: static;
        display: none;
        background: rgba(255, 255, 255, 0.03);
        border: none;
        border-left: 2px solid var(--border-color);
        border-radius: 0;
        box-shadow: none;
        margin-top: 4px;
        margin-left: 12px;
        padding-left: 12px;
        width: calc(100% - 12px);
    }
    
    .nav-dropdown:hover .nav-dropdown-content,
    .nav-dropdown.active .nav-dropdown-content {
        display: flex;
        flex-direction: column;
    }
    
    .user-profile-dropdown {
        border-left: none !important;
        border-top: 1px solid var(--border-color);
        padding-left: 0 !important;
        padding-top: 20px;
        width: 100%;
        margin-top: auto;
        display: flex;
        flex-direction: column;
        gap: 8px;
        align-items: stretch !important;
    }

    .user-profile-trigger {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
    }
    
    .user-info {
        text-align: left !important;
    }

    .user-profile-content {
        position: static;
        display: none;
        background: rgba(255, 255, 255, 0.03);
        border: none;
        border-left: 2px solid var(--border-color);
        border-radius: 0;
        box-shadow: none;
        margin-top: 4px;
        margin-left: 12px;
        padding-left: 12px;
        width: calc(100% - 12px);
    }
    
    .user-profile-dropdown:hover .user-profile-content,
    .user-profile-dropdown.active .user-profile-content {
        display: flex;
        flex-direction: column;
    }
}

@media (max-width: 576px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .section-header div, .section-header .btn {
        width: 100%;
    }
    .section-header .btn {
        display: inline-flex;
        justify-content: center;
    }
    
    .page-title {
        font-size: 22px;
    }
    
    .caixa-status-container span {
        padding: 4px 10px !important;
        font-size: 9px !important;
    }

    /* Modal Responsiveness Improvements */
    .custom-modal {
        align-items: flex-start !important;
        overflow-y: auto !important;
        padding: 20px 12px !important;
    }
    
    .modal-content {
        padding: 20px 16px !important;
        margin: 20px auto !important;
        width: calc(100% - 8px) !important;
        max-width: 100% !important;
    }
    
    .modal-header {
        margin-bottom: 16px !important;
        padding-bottom: 10px !important;
    }
    
    .modal-title {
        font-size: 16px !important;
    }
    
    /* Make modal action buttons stack beautifully on mobile */
    .modal-content form div[style*="justify-content: flex-end"],
    .modal-content div[style*="justify-content: flex-end"],
    .modal-content form div[style*="margin-top: 24px"] {
        flex-direction: column-reverse !important;
        align-items: stretch !important;
        gap: 10px !important;
        display: flex !important;
    }
    
    .modal-content form div[style*="justify-content: flex-end"] .btn,
    .modal-content div[style*="justify-content: flex-end"] .btn,
    .modal-content form div[style*="margin-top: 24px"] .btn {
        width: 100% !important;
        margin: 0 !important;
        justify-content: center !important;
        display: inline-flex !important;
    }
}
