/* =============================================
   Cafe Cocoon Design System
   Based on dashboard.html design
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;600&display=swap');

:root {
    --primary: #f7713c;
    --secondary: #4f474e;
    --accent: #ffd54f;
    --white: #ffffff;
    --glass: rgba(255, 255, 255, 0.15);
    --glass-hover: rgba(255, 255, 255, 0.25);
}

* {
    box-sizing: border-box;
}

html {
    position: relative;
    min-height: 100%;
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: 'Fredoka', sans-serif;
    background-color: var(--primary);
    color: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    margin: 0;
}

/* =============================================
   Animations
   ============================================= */

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

/* =============================================
   Layout Container
   ============================================= */

.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    animation: fadeIn 0.8s ease-out;
}

/* =============================================
   Logo Section
   ============================================= */

.logo-container {
    min-width: 200px;
    max-width: 250px;
    height: 50px;
    background: var(--white);
    border-radius: 50px;
    margin: 0 auto 30px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 600;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    padding: 5px 20px;
}

.logo-container span {
    color: #ffffff;
}

.logo-container img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.logo-icon {
    margin-right: 8px;
    color: var(--secondary);
}

/* =============================================
   Navigation Grid (Dashboard Style)
   ============================================= */

.nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 480px) {
    .nav-grid {
        gap: 3px;
        margin-bottom: 20px;
    }
    
    .nav-item {
        padding: 8px 4px;
    }
    
    .nav-item i {
        font-size: 1rem;
        margin-bottom: 2px;
    }
    
    .nav-item span {
        font-size: 0.5rem;
    }
}

.nav-item {
    background: var(--glass);
    border-radius: 15px;
    aspect-ratio: 1/1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
    text-decoration: none;
    color: var(--white);
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: var(--white);
}

.nav-item span {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-item {
    text-decoration: none;
    color: inherit;
}

.nav-item:hover {
    background: var(--white);
    transform: scale(1.1);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    text-decoration: none;
}

.nav-item:hover i, 
.nav-item:hover span {
    color: var(--primary);
}

.nav-item.active {
    background: var(--white);
}

.nav-item.active i,
.nav-item.active span {
    color: var(--primary);
}

.nav-item.add-stock {
    background: var(--accent);
}

.nav-item.add-stock i, 
.nav-item.add-stock span {
    color: var(--secondary);
}

.nav-item.add-stock:hover {
    background: var(--white);
}

.nav-item.add-stock:hover i,
.nav-item.add-stock:hover span {
    color: var(--primary);
}

/* =============================================
   Stock Panel (Dashboard Style)
   ============================================= */

.stock-panel {
    background: var(--white);
    border-radius: 25px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(79, 71, 78, 0.2);
    color: var(--secondary);
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px dashed #eee;
}

.panel-header h2 {
    font-size: 1.2rem;
    color: var(--primary);
    margin: 0;
}

.stock-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10px;
    border-radius: 15px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.stock-row:hover {
    background-color: #f9f9f9;
}

.item-info {
    display: flex;
    flex-direction: column;
}

.item-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--secondary);
}

.item-category {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
    font-weight: 400;
}

.item-count-box {
    text-align: right;
    background: #f0f0f0;
    padding: 5px 15px;
    border-radius: 20px;
}

.item-count {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.item-unit {
    font-size: 0.7rem;
    color: var(--secondary);
    margin-left: 2px;
}

/* =============================================
   Navbar Styling (Dashboard Theme)
   ============================================= */

.navbar {
    background-color: var(--primary) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-bottom: 2px solid var(--secondary);
    padding: 0 !important;
    height: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;
}

.navbar .container-fluid {
    padding: 8px 15px !important;
    height: 100%;
    display: flex;
    align-items: center;
}

.navbar-brand {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    color: var(--white) !important;
    font-size: 1.1rem;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    height: 100%;
    line-height: 1;
}

.navbar-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    height: 100%;
}

.navbar-nav .nav-item {
    margin: 0;
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar-nav .nav-link {
    background: var(--white) !important;
    color: var(--secondary) !important;
    font-family: 'Fredoka', sans-serif;
    border-radius: 15px;
    padding: 6px 12px !important;
    margin: 0 3px;
    transition: all 0.3s;
    font-weight: 500;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-size: 0.9rem;
    line-height: 1.2;
}

.navbar-nav .nav-link i {
    margin-right: 4px;
    font-size: 0.9rem;
}

.navbar-nav .nav-link:hover {
    background: var(--accent) !important;
    color: var(--secondary) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-link[aria-current="page"] {
    background: var(--accent) !important;
    color: var(--secondary) !important;
    font-weight: 600;
}

.navbar-toggler {
    padding: 4px 8px !important;
    border: 1px solid var(--white) !important;
    border-radius: 8px;
    height: 36px;
    width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
}

.navbar-toggler:focus {
    box-shadow: none;
    outline: none;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 20px;
    height: 20px;
}

/* Responsive navbar */
@media (max-width: 991px) {
    .navbar {
        height: auto !important;
        min-height: 56px !important;
    }
    
    .navbar .container-fluid {
        flex-wrap: wrap;
    }
    
    .navbar-collapse {
        width: 100%;
        margin-top: 8px;
    }
    
    .navbar-nav {
        flex-direction: column;
        gap: 5px;
        width: 100%;
        height: auto;
    }
    
    .navbar-nav .nav-item {
        width: 100%;
        height: auto;
    }
    
    .navbar-nav .nav-link {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

.navbar-text {
    color: var(--white) !important;
    font-family: 'Fredoka', sans-serif;
    font-weight: 500;
    display: flex;
    align-items: center;
    padding: 0 !important;
    margin: 0 10px 0 0 !important;
    height: 100%;
}

.navbar-nav form {
    display: flex;
    align-items: center;
    margin: 0;
    height: 100%;
}

.navbar-nav form button.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
}


/* =============================================
   Main Content Area
   ============================================= */

/* Remove container-fluid styles as we're using app-container directly */

.app-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

main {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Pages with forms/tables need white background */
main:has(form):not(:has(.stock-panel)),
main:has(.table):not(:has(.stock-panel)),
main:has(.card):not(:has(.stock-panel)) {
    background: var(--white);
    border-radius: 25px;
    padding: 0;
    box-shadow: 0 10px 30px rgba(79, 71, 78, 0.2);
    color: var(--secondary);
}

/* Fallback for browsers that don't support :has() */
main.has-content-panel {
    background: var(--white);
    border-radius: 25px;
    padding: 0;
    box-shadow: 0 10px 30px rgba(79, 71, 78, 0.2);
    color: var(--secondary);
}

/* Dropdown in nav-grid */
.nav-grid .dropdown {
    width: 100%;
    height: 100%;
    position: relative;
}

.nav-grid .dropdown .nav-link {
    width: 100%;
    height: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: inherit;
    background: transparent;
    border: none;
    text-decoration: none;
}

.nav-grid .dropdown .nav-link:hover,
.nav-grid .dropdown .nav-link:focus {
    background: transparent;
    color: inherit;
}

.nav-grid .dropdown.show .nav-item {
    background: var(--white);
}

.nav-grid .dropdown.show .nav-item i,
.nav-grid .dropdown.show .nav-item span {
    color: var(--primary);
}

.nav-grid .dropdown-menu {
    margin-top: 5px;
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(79, 71, 78, 0.2);
}

/* Pages with forms need white background */
main:has(form),
main:has(.table),
main:has(.card) {
    background: var(--white);
    border-radius: 25px;
    padding: 0;
    box-shadow: 0 10px 30px rgba(79, 71, 78, 0.2);
}

/* Fallback for browsers that don't support :has() */
main.has-content-panel {
    background: var(--white);
    border-radius: 25px;
    padding: 0;
    box-shadow: 0 10px 30px rgba(79, 71, 78, 0.2);
}

/* =============================================
   Buttons (Dashboard Theme)
   ============================================= */

.btn {
    font-family: 'Fredoka', sans-serif;
    border-radius: 15px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #e04e16;
    border-color: #e04e16;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 94, 30, 0.3);
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.btn-warning {
    background-color: var(--accent);
    border-color: var(--accent);
    color: var(--secondary);
}

.btn-warning:hover {
    background-color: #ffc107;
    border-color: #ffc107;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 213, 79, 0.3);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
}

.btn:focus, 
.btn:active:focus, 
.btn-link.nav-link:focus, 
.form-control:focus, 
.form-select:focus {
    box-shadow: 0 0 0 0.1rem var(--white), 0 0 0 0.25rem var(--primary);
}

/* =============================================
   Forms (Dashboard Theme)
   ============================================= */

.form-label {
    font-family: 'Fredoka', sans-serif;
    font-weight: 500;
    color: var(--secondary);
    margin-bottom: 8px;
}

.form-control,
.form-select {
    font-family: 'Fredoka', sans-serif;
    border-radius: 15px;
    border: 2px solid #e0e0e0;
    padding: 10px 15px;
    transition: all 0.3s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.1rem var(--white), 0 0 0 0.25rem rgba(255, 94, 30, 0.25);
}

.form-group {
    margin-bottom: 1rem;
}

.form-check-label {
    font-family: 'Fredoka', sans-serif;
}

.text-danger {
    color: #dc3545 !important;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.875rem;
}

/* =============================================
   Tables (Dashboard Theme)
   ============================================= */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 15px;
    overflow: hidden;
}

.table {
    font-family: 'Fredoka', sans-serif;
    border-radius: 15px;
}

.table thead {
    background-color: var(--primary);
    color: var(--white);
}

.table thead th {
    border: none;
    padding: 15px;
    font-weight: 600;
}

.table tbody tr {
    transition: all 0.2s;
}

.table tbody tr:hover {
    background-color: #f9f9f9;
    transform: scale(1.01);
}

.table tbody td {
    padding: 15px;
    border-color: #f0f0f0;
}

@media (max-width: 767.98px) {
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .table th,
    .table td {
        padding: 0.4rem 0.3rem;
        font-size: 0.8rem;
    }
}

/* =============================================
   Cards (Dashboard Theme)
   ============================================= */

.card {
    margin-bottom: 1rem;
    border-radius: 15px;
    border: none;
    box-shadow: 0 5px 15px rgba(79, 71, 78, 0.1);
    font-family: 'Fredoka', sans-serif;
}

.card-header {
    background-color: var(--primary);
    color: var(--white);
    border-radius: 15px 15px 0 0 !important;
    font-weight: 600;
}

/* =============================================
   Alerts (Dashboard Theme)
   ============================================= */

.alert {
    border-radius: 15px;
    border: none;
    font-family: 'Fredoka', sans-serif;
    box-shadow: 0 5px 15px rgba(79, 71, 78, 0.1);
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* =============================================
   Category Label
   ============================================= */

.category-label {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: normal;
}

/* =============================================
   Accordion Styling (Orange Theme)
   ============================================= */

.accordion-button {
    font-family: 'Fredoka', sans-serif;
}

.accordion-button:not(.collapsed) {
    background-color: var(--primary);
    color: var(--white);
}

.accordion-button:not(.collapsed)::after {
    filter: brightness(0) invert(1);
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 94, 30, 0.25);
    border-color: var(--primary);
}

/* =============================================
   Touch-friendly buttons (Mobile)
   ============================================= */

@media (max-width: 767.98px) {
    .btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }
}

/* =============================================
   Responsive Navigation Grid
   ============================================= */

/* =============================================
   User Menu (Hamburger Menu)
   ============================================= */

.user-menu-container {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1000;
}

.user-menu-toggle {
    background: var(--white);
    border: none;
    border-radius: 15px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--secondary);
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.user-menu-toggle:hover {
    background: var(--accent);
    transform: scale(1.05);
}

.user-menu-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(79, 71, 78, 0.2);
    min-width: 200px;
    display: none;
    overflow: hidden;
    animation: fadeIn 0.3s ease-out;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-header {
    padding: 15px 20px;
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Fredoka', sans-serif;
}

.user-menu-header i {
    font-size: 1.5rem;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--secondary);
    text-decoration: none;
    transition: all 0.2s;
    font-family: 'Fredoka', sans-serif;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.user-menu-item:hover {
    background: #f9f9f9;
    color: var(--primary);
}

.user-menu-item i {
    width: 20px;
    text-align: center;
    color: var(--secondary);
}

.user-menu-item:hover i {
    color: var(--primary);
}

.user-menu-item-form {
    width: 100%;
}

.user-menu-item-button {
    font-family: 'Fredoka', sans-serif;
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .simple-layout-body {
        padding: 10px !important;
    }
    
    .nav-grid {
        gap: 3px;
        margin-bottom: 15px;
    }
    
    .nav-item {
        padding: 8px 4px;
    }
    
    .nav-item span {
        font-size: 0.5rem;
    }
    
    .nav-item i {
        font-size: 1rem;
        margin-bottom: 2px;
    }
    
    .app-container {
        padding: 5px;
    }
    
    main {
        padding: 8px;
    }
    
    .stock-panel {
        padding: 10px;
        border-radius: 20px;
    }
    
    .panel-header {
        margin-bottom: 15px;
        padding-bottom: 8px;
    }
    
    .panel-header h2 {
        font-size: 1.1rem;
    }
    
    .stock-row {
        padding: 12px 8px;
        margin-bottom: 6px;
    }
    
    .user-menu-dropdown {
        min-width: 180px;
        right: -10px;
    }
}

/* =============================================
   Footer
   ============================================= */

footer {
    margin-top: auto;
    padding-top: 40px;
    font-size: 0.8rem;
    opacity: 0.8;
    text-align: center;
    color: var(--white);
    font-family: 'Fredoka', sans-serif;
}

/* =============================================
   Select2 Customization
   ============================================= */

.select2-container--bootstrap-5 .select2-selection {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    min-height: 38px;
    font-family: 'Fredoka', sans-serif;
}

.select2-container--bootstrap-5 .select2-selection--single {
    padding: 0.375rem 0.75rem;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding-left: 0;
    color: var(--secondary);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-family: 'Fredoka', sans-serif;
}

.select2-container--bootstrap-5 .select2-results__option {
    padding: 0.5rem 0.75rem;
    color: var(--secondary);
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: var(--primary);
    color: var(--white);
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-family: 'Fredoka', sans-serif;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(255, 123, 0, 0.25);
}
