/* ============== GLOBAL STYLES ============== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

a {
    color: #667eea;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============== HEADER & NAVIGATION ============== */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.app-title {
    font-size: 24px;
    font-weight: bold;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 5px 10px;
    margin-right: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info span {
    font-size: 14px;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border: 1px solid white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============== SIDEBAR ============== */
.sidebar {
    background: white;
    border-right: 1px solid #ddd;
    padding: 20px 0;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin: 0;
}

.sidebar a {
    display: block;
    padding: 12px 20px;
    color: #333;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar a:hover,
.sidebar a.active {
    background: #f0f0f0;
    border-left-color: #667eea;
    color: #667eea;
}

/* ============== MAIN LAYOUT ============== */
.main-container {
    display: flex;
    min-height: calc(100vh - 60px);
}

.main-content {
    flex: 1;
    padding: 30px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.page-title {
    font-size: 28px;
    margin-bottom: 25px;
    color: #333;
}

/* ============== FORMS ============== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

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

/* ============== BUTTONS ============== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

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

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

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ============== TABLES ============== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.table thead {
    background: #f8f9fa;
}

.table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #ddd;
    color: #555;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
}

.table tbody tr:hover {
    background: #f9f9f9;
}

.table .action-column {
    width: 150px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    margin-right: 5px;
}

/* ============== CARDS ============== */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.card-body {
    font-size: 14px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    border-left: 4px solid #667eea;
}

.stat-card.success {
    border-left-color: #28a745;
}

.stat-card.danger {
    border-left-color: #dc3545;
}

.stat-card.warning {
    border-left-color: #ffc107;
}

.stat-card .number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
    margin: 10px 0;
}

.stat-card.success .number {
    color: #28a745;
}

.stat-card.danger .number {
    color: #dc3545;
}

.stat-card.warning .number {
    color: #ffc107;
}

.stat-card .label {
    font-size: 14px;
    color: #777;
}

/* ============== ALERTS ============== */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

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

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

/* ============== MODALS ============== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

/* ============== RESPONSIVE ============== */
@media (max-width: 768px) {
    /* Hamburger Menu */
    .sidebar-toggle {
        display: block;
    }
    
    .main-container {
        flex-direction: column;
        position: relative;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 60px;
        width: 100%;
        height: calc(100vh - 60px);
        background: white;
        z-index: 99;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-right: none;
        border-bottom: none;
        overflow-y: auto;
    }
    
    .sidebar::after {
        content: '';
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
        z-index: 98;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar.open::after {
        opacity: 1;
        visibility: visible;
    }
    
    .sidebar ul {
        display: flex;
        flex-direction: column;
    }
    
    .sidebar li {
        flex: none;
        min-width: auto;
    }
    
    .sidebar a {
        padding: 15px 20px;
        text-align: left;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .page-title {
        font-size: 22px;
    }
    
    .app-title {
        font-size: 20px;
    }
    
    .user-info {
        flex-direction: column;
        gap: 10px;
        align-items: flex-end;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
    
    .action-column {
        width: 100px;
    }
    
    .btn-small {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 15px 10px;
    }
    
    .header-container {
        flex-direction: row;
        gap: 10px;
        padding: 10px;
        align-items: center;
    }
    
    .sidebar-toggle {
        order: -1;
        margin-right: 0;
    }
    
    .app-title {
        font-size: 18px;
        flex: 1;
        text-align: center;
    }
    
    .user-info {
        flex-direction: column;
        gap: 5px;
        align-items: flex-end;
        font-size: 12px;
    }
    
    .user-info span {
        font-size: 12px;
    }
    
    .user-info a {
        font-size: 12px !important;
        padding: 4px 8px;
    }
    
    .btn-logout {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }
    
    .card {
        padding: 15px;
    }
    
    .page-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .stat-card .number {
        font-size: 24px;
    }
    
    .stat-card .label {
        font-size: 12px;
    }
}

/* ============== UTILITIES ============== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #999;
}

.loading {
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* ============== OUTLINE BUTTONS ============== */
.btn-outline {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 10px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-block;
    text-align: center;
}

.btn-outline:hover {
    background: #f0f0ff;
    border-color: #667eea;
}

.btn-outline.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ============== FORM SECTIONS & GROUPS ============== */
.form-section {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
    margin-bottom: 15px;
}

.button-grid .btn-outline {
    padding: 12px 8px;
    font-size: 13px;
}

.custom-qty-input {
    margin-top: 15px;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

/* ============== TOTAL & CHANGE DISPLAY ============== */
.total-section,
.change-section {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #667eea;
}

.total-display,
.change-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 500;
}

.total-amount,
.change-amount {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

.change-section {
    border-left-color: #28a745;
    background: #f0fff4;
}

.change-amount {
    color: #28a745;
}

/* ============== SALES FORM CARD & TOTAL CARD ============== */
.sales-form-card {
    margin-bottom: 30px;
}

.sales-total-card {
    margin-top: 40px;
}

/* ============== SUBMIT BUTTON ============== */
.btn-submit {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
}

.btn-submit:hover {
    background: #5568d3;
}

/* ============== MOBILE RESPONSIVE - SALES PAGE ============== */
@media (max-width: 768px) {
    .button-group {
        gap: 8px;
    }
    
    .button-grid {
        grid-template-columns: repeat(auto-fit, minmax(55px, 1fr));
        gap: 6px;
    }
    
    .form-section {
        margin-bottom: 18px;
    }
    
    .sales-form-card {
        margin-bottom: 25px;
        padding: 20px;
    }
    
    .total-display,
    .change-display {
        font-size: 14px;
    }
    
    .total-amount,
    .change-amount {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .sales-form-card {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .button-group {
        gap: 6px;
    }
    
    .button-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 5px;
    }
    
    .button-grid .btn-outline {
        padding: 10px 6px;
        font-size: 12px;
        border-width: 1.5px;
    }
    
    .form-label {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .form-input {
        padding: 10px;
        font-size: 13px;
    }
    
    .form-section {
        margin-bottom: 15px;
    }
    
    .total-section,
    .change-section {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .total-display,
    .change-display {
        font-size: 13px;
    }
    
    .total-amount,
    .change-amount {
        font-size: 16px;
    }
    
    .btn-submit {
        padding: 12px;
        font-size: 15px;
        margin-top: 15px;
    }
    
    .sales-total-card {
        margin-top: 30px;
    }
}
