/* Variables */
:root {
    --primary-color: #722F37;
    --secondary-color: #A4343A;
    --accent-color: #C7375F;
    --background-color: #f8f9fa;
    --text-color: #333;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
}

/* Global Styles */
body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Navbar Customization */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.navbar-dark {
    background-color: var(--primary-color) !important;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
}

.nav-link i {
    margin-right: 0.5rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,.1);
    transition: transform 0.2s ease-in-out;
}

/* Export Dropdown Styles */
.dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    border: none;
    min-width: 280px;
}

.dropdown-header {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    margin: -0.5rem -1rem 0.5rem -1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px 8px 0 0;
}

.export-link {
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.export-link:hover {
    background-color: #f8f9fa;
    padding-left: 1.5rem;
}

.export-link i {
    width: 20px;
    margin-right: 0.75rem;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: #e9ecef;
}

.form-select-sm {
    font-size: 0.875rem;
}

/* Wine Search Styles */
.wine-search-wrapper {
    position: relative;
}

.wine-search-input {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.wine-search-input:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(114, 47, 55, 0.25);
}

.wine-dropdown {
    border: 1px solid #dee2e6;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.wine-option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.15s ease-in-out;
}

.wine-option:hover {
    background-color: #f8f9fa;
}

.wine-option:last-child {
    border-bottom: none;
}

.wine-option strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Form enhancements */
.stock-info {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.quantity-input:disabled {
    background-color: #f8f9fa;
    opacity: 0.6;
}

/* Improved tooltips */
.form-label .fa-info-circle {
    font-size: 0.875rem;
    margin-left: 0.25rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.form-label .fa-info-circle:hover {
    opacity: 1;
}

.card:hover {
    transform: translateY(-5px);
}

/* Dashboard Widgets */
.dashboard-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    border-radius: 15px;
    overflow: hidden;
    background: white;
}

.dashboard-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    position: relative;
    overflow: hidden;
    min-height: 120px;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 180%;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: rotate(15deg);
    transition: transform 0.3s ease;
}

.stat-card:hover::before {
    transform: rotate(25deg) scale(1.1);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.9;
    z-index: 2;
    position: relative;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    z-index: 2;
    position: relative;
}

.stat-card .small {
    font-size: 0.9rem;
    opacity: 0.9;
    z-index: 2;
    position: relative;
}

/* Widget Loading Animations */
.widget-loading {
    display: none;
    text-align: center;
    padding: 1rem;
}

.widget-loading.active {
    display: block;
}

.spinner-border-sm {
    width: 1.5rem;
    height: 1.5rem;
}

/* Activity and Alert Items */
.activity-item {
    border-left: 4px solid var(--primary-color);
    background: rgba(114, 47, 55, 0.05);
    border-radius: 0 12px 12px 0;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    padding: 1rem;
}

.activity-item:hover {
    background: rgba(114, 47, 55, 0.1);
    transform: translateX(8px);
    box-shadow: 0 4px 12px rgba(114, 47, 55, 0.15);
}

.alert-item {
    border-left: 4px solid var(--danger-color);
    background: rgba(220, 53, 69, 0.05);
    border-radius: 0 12px 12px 0;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    padding: 1rem;
}

.alert-item:hover {
    background: rgba(220, 53, 69, 0.1);
    transform: translateX(8px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.15);
}

/* Period Selector */
.period-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.period-selector {
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 25px;
    padding: 0.5rem 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 60px;
    text-align: center;
}

.period-selector:hover,
.period-selector.active {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(114, 47, 55, 0.3);
}

/* Chart Containers */
.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
    padding: 1rem 0;
}

.chart-container-sm {
    position: relative;
    height: 280px;
    width: 100%;
    padding: 1rem 0;
}

/* Enhanced Tables */
.table-responsive {
    border-radius: 10px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table td {
    border: none;
    padding: 0.75rem;
    vertical-align: middle;
}

.table tr:hover {
    background-color: rgba(114, 47, 55, 0.05);
}

/* Badges Enhancement */
.badge {
    font-size: 0.8rem;
    padding: 0.5rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
}

/* Card Headers */
.card-header {
    background: white;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 1.25rem;
}

.card-header h5 {
    color: var(--text-color);
    font-weight: 600;
    margin: 0;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.dashboard-card {
    animation: fadeInUp 0.6s ease-out;
}

.dashboard-card:nth-child(1) { animation-delay: 0.1s; }
.dashboard-card:nth-child(2) { animation-delay: 0.2s; }
.dashboard-card:nth-child(3) { animation-delay: 0.3s; }
.dashboard-card:nth-child(4) { animation-delay: 0.4s; }
.dashboard-card:nth-child(5) { animation-delay: 0.5s; }

/* Responsive Design */
@media (max-width: 768px) {
    .period-controls {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .period-selector {
        border-radius: 8px;
        padding: 0.75rem;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .chart-container,
    .chart-container-sm {
        height: 250px;
        padding: 0.5rem 0;
    }
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px 10px 0 0 !important;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Tables */
.table {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.table-hover tbody tr:hover {
    background-color: rgba(114, 47, 55, 0.1);
}

/* Forms */
.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(114, 47, 55, 0.25);
}

/* Stats Cards */
.stats-card {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.stats-card h3 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stats-card p {
    margin-bottom: 0;
    opacity: 0.8;
}

/* Wine Cards */
.wine-card {
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.wine-card img {
    height: 200px;
    object-fit: cover;
}

.wine-card .card-body {
    padding: 1.5rem;
}

.wine-card .wine-type {
    color: var(--accent-color);
    font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-card {
        margin-bottom: 1rem;
    }
    
    .wine-card img {
        height: 150px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
} 

/* QR Scanner Modal Styles */
#qrScanModal .modal-dialog {
    max-width: 600px;
}

#qr-reader {
    border: 2px dashed var(--primary-color);
    border-radius: 10px;
    padding: 20px;
    background-color: #f8f9fa;
}

#qr-reader video {
    border-radius: 8px;
    width: 100% !important;
    height: auto !important;
}

#scanning-status {
    color: var(--primary-color);
}

#scanning-status .spinner-border {
    color: var(--primary-color) !important;
}

#scan-result .alert {
    border-radius: 10px;
}

#scan-error .alert {
    border-radius: 10px;
}

#wine-info {
    background-color: rgba(114, 47, 55, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.qr-scan-btn {
    position: relative;
    overflow: hidden;
}

.qr-scan-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Mode Selection Styles */
#mode-selection .btn {
    padding: 20px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

#mode-selection .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

#mode-selection .btn i {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

/* Manual Interface Styles */
#manual-scan-input {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    letter-spacing: 1px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

#manual-scan-input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.2rem rgba(114, 47, 55, 0.25);
}

#manual-interface .alert {
    border-left: 4px solid var(--info-color);
    background-color: rgba(23, 162, 184, 0.1);
}

/* Camera Interface Styles */
#camera-interface {
    background-color: rgba(114, 47, 55, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin: 10px 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #qrScanModal .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    #mode-selection .btn {
        padding: 15px;
        margin-bottom: 10px;
    }
    
    #manual-scan-input {
        font-size: 1rem;
    }
}

html {
    zoom: 80%;
}