/* Stock & Sales Management UI - Global Styles */

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

:root {
    /* Color Scheme - Warm & Professional for Food Business */
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --dark-bg: #2C3E50;
    --light-bg: #ECF0F1;
    --white: #FFFFFF;
    --text-dark: #2C3E50;
    --text-light: #7F8C8D;
    --border-color: #BDC3C7;
    --success-color: #27AE60;
    --warning-color: #F39C12;
    --danger-color: #E74C3C;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Container & Layout */
.st-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Navigation */
.st-sidebar {
    width: 250px;
    background: linear-gradient(135deg, var(--dark-bg) 0%, #1a252f 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}

.st-sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    margin: 0 auto 10px;
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.st-sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.st-nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.st-nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-left-color: var(--primary-color);
}

.st-nav-item.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-left-color: var(--accent-color);
}

.st-nav-item .icon {
    font-size: 20px;
}

/* Submenu Styles */
.st-submenu-toggle {
    position: relative;
}

.st-submenu-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s;
}

.st-submenu-toggle.open .st-submenu-arrow {
    transform: rotate(180deg);
}

.st-submenu {
    display: none;
    background-color: rgba(0, 0, 0, 0.2);
    flex-direction: column;
}

.st-submenu.open {
    display: flex;
}

.st-nav-subitem {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 12px 20px 12px 50px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    width: 100%;
    text-align: left;
    font-weight: 500;
}

.st-nav-subitem:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-left-color: var(--accent-color);
}

.st-nav-subitem.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-left-color: var(--accent-color);
}

.st-sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

/* Main Content Area */
.st-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Header/Topbar */
.st-topbar {
    background-color: var(--white);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.st-topbar-left {
    flex: 1;
}

.st-page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.st-topbar-right {
    display: flex;
    gap: 15px;
}

.st-btn-icon {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.st-btn-icon:hover {
    background-color: var(--light-bg);
}

/* Content Area */
.st-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

/* Page Sections */
.st-page {
    display: none;
}

.st-page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Dashboard Cards Grid */
.st-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.st-card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.st-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.st-card-header {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.st-card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.st-card-subtitle {
    font-size: 12px;
    color: var(--text-light);
}

/* Charts Container */
.st-charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.st-chart-box {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.st-chart-box h3 {
    margin-bottom: 20px;
    font-size: 16px;
    color: var(--text-dark);
}

/* Simple Bar Chart */
.simple-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 200px;
    justify-content: space-around;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 6px 6px 0 0;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.chart-bar:hover {
    opacity: 0.8;
}

.chart-bar span {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dark);
}

/* Pie Chart Legend */
.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pie-legend div {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
}

/* Section Box */
.st-section-box {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.st-section-box h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-dark);
    font-weight: 600;
}

.st-section-box h4 {
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text-dark);
    font-weight: 600;
}

.st-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.st-section-header h2 {
    font-size: 24px;
    color: var(--text-dark);
}

/* Data Table */
.st-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.st-data-table thead {
    background-color: var(--light-bg);
}

.st-data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
}

.st-data-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--text-dark);
}

.st-data-table tbody tr:hover {
    background-color: #f9f9f9;
}

.st-data-table.compact td {
    padding: 10px 15px;
}

/* Badges */
.st-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.st-badge.active {
    background-color: #D4EDDA;
    color: var(--success-color);
}

.st-badge.low {
    background-color: #FFE5E5;
    color: var(--danger-color);
}

.st-badge.inactive {
    background-color: #F0F0F0;
    color: var(--text-light);
}

.st-badge.safe {
    background-color: #D4EDDA;
    color: var(--success-color);
}

/* Filters Bar */
.st-filters-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.st-input-field {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 200px;
    /* width: 100%; */
}

.st-input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.st-input-field.small {
    min-width: 100px;
}

/* Buttons */
.st-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.st-btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.st-btn-primary:hover {
    background-color: #E85555;
    box-shadow: var(--shadow-lg);
}

.st-btn-secondary {
    background-color: var(--light-bg);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.st-btn-secondary:hover {
    background-color: #D5DBDB;
}

.st-btn-success {
    background-color: var(--success-color);
    color: var(--white);
}

.st-btn-success:hover {
    background-color: #229954;
}

.st-btn-info {
    background-color: var(--secondary-color);
    color: var(--white);
}

.st-btn-info:hover {
    background-color: #45B7AA;
}

.st-btn-block {
    width: 100%;
    margin-bottom: 10px;
}

.st-btn-small {
    padding: 6px 12px;
    font-size: 11px;
}

/* Sales/POS Panel */
.st-sales-st-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.st-pos-panel {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.st-pos-panel h3 {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}

.st-pos-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.st-pos-controls .st-input-field {
    flex: 1;
    min-width: unset;
}

.st-pos-controls .st-btn {
    white-space: nowrap;
}

/* Payment Summary */
.st-payment-summary {
    background-color: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.st-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.st-summary-row.total {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.st-summary-row.change {
    font-weight: 700;
    border-bottom: none;
    padding-top: 15px;
}

.st-summary-row .st-input-field {
    min-width: 150px;
}

/* Form Styles */
.st-form-group {
    margin-bottom: 15px;
}

.st-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-dark);
}

.st-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.st-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

textarea.st-input-field {
    resize: vertical;
    min-height: 60px;
}

/* Modal Styles */
.st-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.st-modal.show {
    display: flex;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.st-modal-content {
    background: var(--white);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

.st-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-dark);
}

.st-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.st-modal-close:hover {
    color: var(--text-dark);
}

.st-modal-content > form {
    padding: 20px;
}

/* Toast Notification */
.st-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--success-color);
    color: var(--white);
    padding: 15px 20px;
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 2000;
    animation: slideInUp 0.3s ease;
}

.st-toast.show {
    display: block;
}

@keyframes slideInUp {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Tabs */
.st-tabs-st-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.st-tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-light);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    text-transform: uppercase;
}

.st-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.st-tab-content {
    display: none;
}

.st-tab-content.active {
    display: block;
}

/* Action Buttons in Table */
.st-action-btns {
    display: flex;
    gap: 8px;
}

.st-btn-edit, .st-btn-delete, .st-btn-view {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.st-btn-edit {
    background-color: #E3F2FD;
    color: #1976D2;
}

.st-btn-edit:hover {
    background-color: #BBDEFB;
}

.st-btn-delete {
    background-color: #FFEBEE;
    color: var(--danger-color);
}

.st-btn-delete:hover {
    background-color: #FFCDD2;
}

.st-btn-view {
    background-color: #F0F4C3;
    color: #F39C12;
}

.st-btn-view:hover {
    background-color: #E6F3A4;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .st-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .st-charts-container {
        grid-template-columns: 1fr;
    }
    
    .st-input-field {
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    .st-container {
        flex-direction: column;
    }
    
    .st-sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
    }
    
    .st-sidebar-nav {
        flex-direction: row;
        padding: 10px 0;
    }
    
    .st-nav-item {
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .st-nav-item span:last-child {
        display: none;
    }
    
    .st-sidebar-footer {
        display: none;
    }
    
    .st-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .st-data-table {
        font-size: 12px;
    }
    
    .st-data-table th, .st-data-table td {
        padding: 10px;
    }
    
    .st-input-field {
        min-width: 120px;
    }
    
    .st-content-area {
        padding: 15px;
    }
    
    .st-topbar {
        padding: 15px;
    }
}

/* Broadcast Page Styles */
.st-broadcast-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.st-broadcast-section {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.st-broadcast-section h3 {
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.st-recipient-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.st-recipient-tab {
    padding: 10px 20px;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s;
}

.st-recipient-tab:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.st-recipient-tab.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.st-recipient-panel {
    display: none;
}

.st-recipient-panel.active {
    display: block;
}

.st-info-box {
    background: #F0F7FF;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    margin-top: 15px;
}

.st-info-box p {
    margin: 5px 0;
    font-size: 13px;
    color: var(--text-dark);
}

.st-customer-selection-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    margin: 15px 0;
}

.st-contact-checkbox-item {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.st-contact-checkbox-item:last-child {
    border-bottom: none;
}

.st-contact-checkbox-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
}

.st-contact-checkbox-item input[type="checkbox"] {
    cursor: pointer;
}

.st-file-upload {
    display: flex;
    gap: 10px;
    align-items: center;
}

.st-file-upload input[type="file"] {
    display: none;
}

.st-whatsapp-preview-st-card {
    background: linear-gradient(135deg, #ECE5DD 0%, #F5F5F5 100%);
    border-radius: 12px;
    padding: 20px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.st-preview-bubble {
    background: var(--white);
    border-radius: 10px;
    padding: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 15px;
    max-width: 80%;
}

.st-preview-image {
    margin-bottom: 10px;
}

.st-preview-image img {
    max-width: 100%;
    border-radius: 8px;
    max-height: 150px;
}

.st-preview-text {
    font-size: 13px;
    color: var(--text-dark);
    line-height: 1.5;
    word-wrap: break-word;
}

.st-preview-info {
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 12px;
}

.st-preview-info p {
    margin: 5px 0;
}

.st-broadcast-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.st-broadcast-actions .st-btn {
    flex: 1;
    min-width: 150px;
}

.st-btn-large {
    font-size: 14px;
    padding: 12px 24px;
}

/* Customer/Group Styles */
.st-contact-group-panel {
    margin-top: 20px;
}

@media (max-width: 480px) {
    .st-sidebar {
        flex-direction: column;
        height: 60px;
    }
    
    .st-sidebar-header {
        display: none;
    }
    
    .st-sidebar-nav {
        flex-direction: row;
        padding: 10px;
        gap: 0;
        justify-content: space-around;
    }
    
    .st-nav-item {
        padding: 8px 10px;
        gap: 0;
    }
    
    .st-nav-item .icon {
        font-size: 18px;
    }
    
    .st-cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .st-form-row {
        grid-template-columns: 1fr;
    }
    
    .st-filters-bar {
        flex-direction: column;
    }
    
    .st-input-field {
        width: 100%;
        min-width: unset;
    }
    
    .st-modal-content {
        width: 95%;
        max-width: 95%;
    }
    
    .st-data-table {
        font-size: 11px;
    }
    
    .st-data-table th, .st-data-table td {
        padding: 8px;
    }
    
    .st-topbar {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .st-broadcast-actions {
        flex-direction: column;
    }
    
    .st-broadcast-actions .st-btn {
        min-width: unset;
    }
    
    .st-whatsapp-preview-st-card {
        min-height: 200px;
    }
    
    .st-preview-bubble {
        max-width: 100%;
    }
}