﻿@import 'animations.css';

:root {
    /* Colors */
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    /* Fully opaque or very high opacity hex */
    /* Darkened for more solidity */
    --bg-card-hover: rgba(51, 65, 85, 0.9);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-gold: #fbbf24;
    --accent-gold-hover: #f59e0b;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-neon: #38bdf8;
    --danger: #ef4444;
    --success: #22c55e;

    /* Glassmorphism Settings */
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);

    /* Global Gradient Definition for Syncing */
    --hero-pattern:
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(251, 191, 36, 0.1) 0px, transparent 50%);

    /* Typography */
    --font-main: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    position: relative;

    /* Primary Background Layer */
    background-image: var(--hero-pattern);
    background-attachment: fixed;
    /* Locks background to viewport */
    background-size: cover;
    background-repeat: no-repeat;
}

/* Remove the old body::before layer since we use standard background-attachment now */

/* Typography Overrides */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.025em;
}

.text-muted {
    color: var(--text-secondary) !important;
}

.text-gold {
    color: var(--accent-gold) !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.btn-primary {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.btn-primary:hover {
    background-color: var(--accent-blue-hover);
    border-color: var(--accent-blue-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
}

.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
}

.btn-glass {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-glass:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.hover-danger:hover {
    color: var(--danger) !important;
    background-color: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Form Controls */
.form-control,
.form-select {
    background-color: rgba(15, 23, 42, 0.6);
    border: var(--glass-border);
    color: var(--text-primary);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(15, 23, 42, 0.8);
    border-color: var(--accent-neon);
    color: var(--text-primary);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
}

.form-control::placeholder {
    color: rgba(148, 163, 184, 0.5);
}

/* Tables */
.table {
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.1);
}

.table> :not(caption)>*>* {
    background-color: transparent;
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.table-hover>tbody>tr:hover>* {
    color: var(--text-primary);
    background-color: rgba(59, 130, 246, 0.1) !important;
}

.table-striped>tbody>tr:nth-of-type(odd)>* {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
}

.table thead th {
    color: var(--text-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom-width: 1px;
}

/* Override Bootstrap table-dark variables */
.table-dark {
    --bs-table-hover-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-active-bg: transparent;
}

/* 
   FAKE GLASS IMPLEMENTATION
   Uses a synced background layer with blur to mimic backdrop-filter.
   Performance: 10x faster as it doesn't read from the framebuffer.
*/

/* Shared glass styles */
.glass-card,
.card,
.navbar,
.modal-content,
.dropdown-menu {
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    background-color: #1e293b;
    /* Fallback opaque */
    background-color: rgba(30, 41, 59, 0.98);
    /* 98% opacity */
    /* Semi-transparent tint */
    position: relative;
    /* Context for pseudo */
    overflow: hidden;
    /* Clip the blurred edges */
    z-index: 1;
    /* Ensure content is above pseudo */
    /* backdrop-filter: none;  ENSURE THIS IS OFF */
    transform: translateZ(0);
    /* Hardware accelerate container */
}

/* The Blurred Layer */
.glass-card::before,
.card::before,
.navbar::before,
.modal-content::before,
.dropdown-menu::before {
    content: '';
    position: absolute;
    inset: 0;

    /* Sync with Body Background */
    background-image: var(--hero-pattern);
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;

    /* The Blur Magic - REMOVED as per user request to simplify/debug */
    /* filter: blur(12px); */

    /* Scale up to hide blurry edges */
    margin: -20px;
    z-index: -1;
    pointer-events: none;
}

/* Specific Card Tweaks */
.glass-card,
.card {
    border-radius: 1rem;
    transition: transform 0.2s ease, background 0.2s ease;
}

.modal-content {
    border-radius: 1rem;
}

.dropdown-menu {
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.card-header {
    background-color: rgba(255, 255, 255, 0.05);
    border-bottom: var(--glass-border);
    position: relative;
    z-index: 2;
}

.card-footer {
    background-color: rgba(255, 255, 255, 0.05);
    border-top: var(--glass-border);
    position: relative;
    z-index: 2;
}

/* Navbar specific tweak */
.navbar {
    background-color: rgba(15, 23, 42, 0.85);
    /* Slightly darker for legibility */
}

.navbar-brand {
    color: var(--text-primary) !important;
}

.navbar-brand i {
    color: var(--accent-blue) !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

/* Custom Badges */
.badge-active-bright {
    background-color: rgba(74, 222, 128, 0.15) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(74, 222, 128, 0.3) !important;
}

.badge-encargado {
    background-color: rgba(168, 85, 247, 0.15) !important;
    color: #c084fc !important;
    border: 1px solid rgba(168, 85, 247, 0.3) !important;
}

.text-active-bright {
    color: #4ade80 !important;
}

/* Seamless Input Group */
.input-group-seamless {
    background-color: rgba(15, 23, 42, 0.6);
    border: var(--glass-border);
    border-radius: 0.5rem;
    transition: all 0.2s;
    position: relative;
    /* For z-index safety */
    z-index: 2;
}

.input-group-seamless:focus-within {
    background-color: rgba(15, 23, 42, 0.8);
    border-color: var(--accent-neon);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
}

.input-group-seamless .input-group-text,
.input-group-seamless .form-control {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* End of Performance Tweaks */

/* --- Refactored Utilities (Unified) --- */

/* Compact form controls for dense tables */
.form-control-compact {
    padding: 0.25rem 0.4rem;
    font-size: 0.875rem;
}

/* Width Utilities */
.w-60 {
    max-width: 60px;
}

.w-80 {
    max-width: 80px;
}

.w-100px {
    min-width: 100px;
}

.w-150px {
    min-width: 150px;
}

/* Custom Plaintext Input (Ghost Input) */
.input-plaintext-custom {
    background: transparent;
    border: none;
    color: #fff;
    font-weight: bold;
    padding-right: 0;
    text-align: center;
    width: 100%;
    outline: none;
}

.input-plaintext-custom:focus {
    box-shadow: none;
}

/* Review Source Icons/Colors (Future proofing) */
.source-medallia {
    color: var(--accent-gold);
}

.source-google {
    color: var(--accent-blue);
}

/* Hover Effects for Dashboard Cards */
.hover-scale-up {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.hover-scale-up:hover {
    transform: scale(1.05);
    /* Slight magnification */
    z-index: 10;
}

/* Colored Glows matching theme colors */
.hover-glow-success:hover {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.6);
    /* --success */
}

.hover-glow-info:hover {
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
    /* --accent-neon */
}

.hover-glow-warning:hover {
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
    /* --accent-gold */
}

.hover-glow-primary:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
    /* --accent-blue */
}

/* User Menu Dropdown */
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 240px;
    background-color: #1e293b;
    /* Fallback */
    background-color: rgba(30, 41, 59, 0.98);
    /* 98% opacity */
    border: var(--glass-border);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    border-radius: 1rem;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    z-index: 1050;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: fadeInDropdown 0.2s ease-out;
}

.user-menu-dropdown.show {
    display: flex;
}

.user-menu-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background-color: #1e293b;
    /* Fallback */
    background-color: rgba(30, 41, 59, 0.98);
    /* 98% opacity */
    border-top: var(--glass-border);
    border-left: var(--glass-border);
    transform: rotate(45deg);
    z-index: 0;
}

.user-menu-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1;
}

.user-menu-item {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
    border-radius: 0.5rem;
    position: relative;
    z-index: 1;
    font-size: 0.95rem;
}

.user-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.user-menu-item.text-danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* AVATAR WRAPPER (Special Borders) */
.avatar-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.avatar-bg-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    /* Slightly larger than avatar */
    height: 120%;
    border-radius: 50%;
    z-index: -1;
    /* Animation and background set inline via renderer */
}

/* Ensure image stays on top */
.avatar-wrapper img {
    position: relative;
    z-index: 2;
    background-color: var(--bg-card);
    /* fallback */
}

/* Badge Icon Overlay */
.avatar-badge-icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--bg-body);
    /* seamless look */
}

.avatar-badge-icon i {
    font-size: 0.8rem !important;
    /* Smaller icon inside larger circle */
}

/* Waiter Ranking List - Circle Icon */
.ranking-list-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-left: 8px;
    vertical-align: middle;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Responsive Tables (Card View on Mobile) */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: visible;
    }

    #linesTable thead,
    #reviewsTable thead {
        display: none;
    }

    #linesTable tbody tr,
    #reviewsTable tbody tr {
        display: block;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0.75rem;
        margin-bottom: 1rem;
        padding: 1rem;
        position: relative;
    }

    #linesTable tbody td,
    #reviewsTable tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        padding: 0.5rem 0;
        text-align: right;
    }

    #linesTable tbody td::before,
    #reviewsTable tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        text-transform: uppercase;
        font-size: 0.75rem;
        margin-right: 1rem;
        text-align: left;
    }

    /* Adjust inputs for mobile */
    .form-control-compact {
        width: auto !important;
        max-width: 120px !important;
        text-align: right;
    }

    .w-60,
    .w-80 {
        max-width: 80px !important;
        width: auto !important;
    }

    /* Specific fixes for remove button */
    #linesTable tbody td:last-child,
    #reviewsTable tbody td:last-child {
        justify-content: flex-end;
        padding-top: 0;
        margin-top: -3.5rem;
        /* Move up to top right corner */
        position: absolute;
        top: 1rem;
        right: 1rem;
    }

    #linesTable tbody td:last-child::before,
    #reviewsTable tbody td:last-child::before {
        content: none;
    }

    /* Totals Footer */
    #linesTable tfoot tr {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    #linesTable tfoot td {
        display: flex;
        justify-content: space-between;
        width: 100%;
        border: none;
        padding: 0.25rem 0;
    }

    #linesTable tfoot td::before {
        content: attr(data-label);
        color: var(--text-secondary);
        font-size: 0.8rem;
    }

    /* Override for the Add Button Row in TFoot */
    #linesTable tfoot tr#addRowBtnRow {
        background: transparent;
        border: none;
        padding: 0;
        margin-top: -0.5rem;
        /* Slight pull up */
        margin-bottom: 0.5rem;
    }

    #linesTable tfoot tr#addRowBtnRow td {
        display: block;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    #linesTable tfoot tr#addRowBtnRow td::before {
        content: none !important;
    }
}

/* Hover Zoom for Avatar */
.hover-zoom-avatar {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center center;
}

.hover-zoom-avatar:hover {
    transform: scale(1.1);
    z-index: 15;
    /* Ensure it pops slightly above siblings if needed */
}


.card-hover-effect {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card-hover-effect:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
