/* Public Frontend Styles for Saku Grocery */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    margin-bottom: 0;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    transition: all 0.2s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-success {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #218838;
}

.btn-light {
    color: #212529;
    background-color: #f8f9fa;
    border-color: #f8f9fa;
}

.btn-light:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
}

.btn-outline-primary {
    color: #007bff;
    background-color: transparent;
    border-color: #007bff;
}

.btn-outline-primary:hover {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.btn-outline-light {
    color: #f8f9fa;
    background-color: transparent;
    border-color: #f8f9fa;
}

.btn-outline-light:hover {
    color: #212529;
    background-color: #f8f9fa;
    border-color: #f8f9fa;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.25rem;
    border-radius: 0.5rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

/* Forms */
.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    line-height: 1.25;
    color: #495057;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Layout Utilities */
.d-flex {
    display: flex !important;
}

.flex-fill {
    flex: 1 1 auto !important;
}

.align-items-center {
    align-items: center !important;
}

.justify-content-center {
    justify-content: center !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.text-center {
    text-align: center !important;
}

.text-muted {
    color: #6c757d !important;
}

.bg-light {
    background-color: #f8f9fa !important;
}

.me-2 {
    margin-right: 0.5rem !important;
}

.ms-auto {
    margin-left: auto !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.p-3 {
    padding: 1rem !important;
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-lg-4,
.col-md-6,
.col-12 {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (min-width: 992px) {
    .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

/* Cards */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.375rem;
}

.card-body {
    flex: 1 1 auto;
    padding: 1.5rem;
}

.card-title {
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    font-weight: 500;
}

.card-text {
    margin-bottom: 1rem;
}

/* Alerts */
.alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert-dismissible {
    padding-right: 4rem;
}

.btn-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    padding: 0.375rem 0.75rem;
    margin: 0.25rem 0.25rem 0.25rem auto;
    background: transparent;
    border: 0;
    border-radius: 0.375rem;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 0.75;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.bg-success {
    background-color: #28a745 !important;
}

.bg-primary {
    background-color: #007bff !important;
}

.bg-warning {
    background-color: #ffc107 !important;
}

.bg-danger {
    background-color: #dc3545 !important;
}

/* Navbar Basic Styles */
.navbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.navbar-brand {
    padding-top: 0.3125rem;
    padding-bottom: 0.3125rem;
    margin-right: 1rem;
    font-size: 1.25rem;
    text-decoration: none;
    white-space: nowrap;
}

.navbar-nav {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}

.nav-link {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 10rem;
    padding: 0.5rem 0;
    margin: 0;
    font-size: 1rem;
    color: #212529;
    text-align: left;
    list-style: none;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.375rem 1.5rem;
    clear: both;
    font-weight: 400;
    color: #212529;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
}

.dropdown-item:hover {
    color: #16181b;
    background-color: #e9ecef;
}

/* Public-specific styles */
.public-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.public-main {
    flex: 1;
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    list-style: none;
    background-color: #e9ecef;
    border-radius: 0.375rem;
}

.breadcrumb-item {
    display: flex;
}

.breadcrumb-item + .breadcrumb-item {
    padding-left: 0.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    display: inline-block;
    padding-right: 0.5rem;
    color: #6c757d;
    content: ">";
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* Pagination */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: 0.375rem;
}

.page-link {
    position: relative;
    display: block;
    padding: 0.5rem 0.75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: #007bff;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #dee2e6;
}

.page-link:hover {
    z-index: 2;
    color: #0056b3;
    text-decoration: none;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

/* Spinner/Loading */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive utilities */
@media (max-width: 576px) {
    .container {
        padding: 0 10px;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1.1rem;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    /* Header responsive */
    .public-header .navbar-nav {
        text-align: center;
    }
    
    .public-header .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }
    
    /* Product cards mobile */
    .product-card {
        margin-bottom: 1rem;
    }
    
    .product-card .card-body {
        padding: 1rem;
    }
    
    /* Forms mobile */
    .form-row {
        flex-direction: column;
    }
    
    .form-col {
        margin-bottom: 1rem;
    }
    
    /* Checkout mobile */
    .checkout-section {
        margin-bottom: 1rem;
    }
    
    .order-summary {
        position: sticky;
        top: 20px;
    }
    
    /* Profile mobile */
    .profile-stats {
        text-align: center;
    }
    
    .profile-stats .stat-card {
        margin-bottom: 1rem;
    }
    
    /* Order history mobile */
    .order-card {
        margin-bottom: 1rem;
    }
    
    .order-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .order-info {
        flex-direction: column;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .order-detail {
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 768px) {
    /* Navigation improvements */
    .navbar-toggler {
        border: none;
        padding: 0.25rem 0.5rem;
    }
    
    .navbar-collapse {
        margin-top: 1rem;
        border-top: 1px solid #e9ecef;
        padding-top: 1rem;
    }
    
    /* Search bar mobile */
    .search-form {
        margin: 1rem 0;
    }
    
    .search-form .input-group {
        flex-direction: column;
    }
    
    .search-form .form-control {
        margin-bottom: 0.5rem;
        border-radius: 0.375rem !important;
    }
    
    .search-form .btn {
        border-radius: 0.375rem !important;
    }
    
    /* Product grid tablet */
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }
    
    /* Cart mobile improvements */
    .cart-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cart-item .item-image {
        align-self: center;
        margin-bottom: 1rem;
    }
    
    .cart-item .item-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 1rem;
    }
    
    /* Quantity controls mobile */
    .quantity-controls {
        margin-right: 0 !important;
    }
    
    /* Order items mobile */
    .order-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .order-item .item-image {
        align-self: center;
        margin-bottom: 1rem;
    }
    
    /* Filters mobile */
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        margin-bottom: 1rem;
    }
    
    .filter-select {
        width: 100%;
    }
    
    /* Modal mobile */
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    /* Table responsive */
    .table-responsive {
        border: none;
    }
    
    .table-responsive table {
        font-size: 0.875rem;
    }
    
    /* Footer mobile */
    .public-footer .row {
        flex-direction: column;
    }
    
    .public-footer .footer-section {
        text-align: center;
        margin-bottom: 2rem;
    }
}

@media (max-width: 992px) {
    /* Hero section tablet */
    .hero-section {
        padding: 4rem 0;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    /* Product grid laptop */
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
    
    /* Checkout tablet */
    .checkout-container .row {
        flex-direction: column-reverse;
    }
    
    .checkout-container .col-lg-8,
    .checkout-container .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .public-header,
    .public-footer,
    .btn,
    .pagination {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }
}

/* Floating Help Button */
.floating-help-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.floating-help-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(40, 167, 69, 0.6);
    color: white;
    text-decoration: none;
}

.floating-help-btn:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.floating-help-btn:hover:before {
    width: 100px;
    height: 100px;
}

.floating-help-btn .fa-headset {
    position: relative;
    z-index: 2;
}

@media (max-width: 768px) {
    .floating-help-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}