/**
 * Modern Form Controls Styling
 * Optimized and reusable styles for form inputs, buttons, and controls
 */

/* ==================== Form Inputs & Selects ==================== */
.form-control, 
.form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 0.625rem 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.form-control:focus, 
.form-select:focus {
    border-color: #04966a;
    box-shadow: 0 0 0 0.25rem rgba(4, 150, 106, 0.15);
    outline: none;
}

/* Textarea specific styling */
textarea.form-control {
    border-radius: 10px;
    min-height: 100px;
}

/* ==================== Input Groups ==================== */
.input-group {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    overflow: hidden;
}

.input-group-text {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #e9ecef;
    border-right: none;
    transition: all 0.3s ease;
}

.input-group .form-control,
.input-group .form-select {
    border-left: none;
}

.input-group:focus-within .input-group-text {
    background: linear-gradient(135deg, #e7f9f3 0%, #d4f1e8 100%);
    border-color: #04966a;
}

/* ==================== Modern Buttons ==================== */
.btn {
    border-radius: 8px;
    padding: 0.625rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.btn-primary, 
.btn.primary {
    background: linear-gradient(135deg, #04966a 0%, #037550 100%);
    border: none;
    color: white;
}

.btn-outline-primary {
    border: 2px solid #04966a;
    color: #04966a;
    background: white;
}

.btn-outline-primary:hover {
    background: #04966a;
    color: white;
}

.btn-outline-secondary {
    border: 2px solid #6c757d;
    border-radius: 10px;
}

/* ==================== Mobile Friendly Buttons ==================== */
@media (max-width: 768px) {
    .btn-sm-mobile {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .btn-sm-mobile .btn-text {
        display: none;
    }
    
    .btn-sm-mobile i {
        margin: 0 !important;
        font-size: 1.1rem;
    }
    
    .toolbar-modern .d-flex.gap-2 {
        gap: 0.5rem !important;
    }
}

@media (max-width: 576px) {
    .btn-sm-mobile {
        padding: 0.4rem 0.6rem;
        min-width: 42px;
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ==================== Header Action Buttons ==================== */
.header-action-btn {
    padding: 0.625rem 1.5rem;
    color: white;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.header-action-btn i {
    font-size: 1.2rem;
}

.header-action-btn:hover {
    transform: translateY(-2px);
}

/* Purchase Button */
.header-btn-purchase {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.header-btn-purchase:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    color: white;
}

/* Sale Button */
.header-btn-sale {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.header-btn-sale:hover {
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.5);
    color: white;
}

/* POS Button */
.header-btn-pos {
    background: linear-gradient(135deg, #fad961 0%, #f76b1c 100%);
    box-shadow: 0 4px 15px rgba(247, 107, 28, 0.4);
}

.header-btn-pos:hover {
    box-shadow: 0 6px 20px rgba(247, 107, 28, 0.5);
    color: white;
}

/* Mobile Responsive */

@media (max-width: 992px) {
    .header-action-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 768px) {
    .header-action-btn {
        padding: 0.5rem 0.75rem;
    }
    
    .header-action-btn .btn-text {
        display: none;
    }
    
    .header-action-btn i {
        margin: 0 !important;
        font-size: 1.3rem !important;
    }
    
    .header-action-btn {
        gap: 0 !important;
    }
    
    .top-menu .navbar-nav {
        gap: 0.35rem !important;
    }
}

@media (max-width: 576px) {
    .header-action-btn {
        padding: 0.4rem 0.6rem;
        min-width: 40px;
        min-height: 40px;
    }
    
    .header-action-btn i {
        font-size: 1.2rem !important;
    }
}

/* ==================== Modern Switch Toggle ==================== */
.form-switch .form-check-input {
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
    border-radius: 2rem;
    transition: all 0.3s ease;
}

.form-switch .form-check-input:checked {
    background-color: #04966a;
    border-color: #04966a;
}

/* ==================== Invoice Details Page ==================== */
.modern-invoice-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: visible;
    position: relative;
}

/* Payment Status Corner Ribbon */
.payment-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.5rem 1.5rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.payment-ribbon::before,
.payment-ribbon::after {
    content: '';
    position: absolute;
    top: 100%;
    width: 0;
    height: 0;
    border-style: solid;
}

.payment-ribbon::before {
    left: 0;
    border-width: 5px 0 0 10px;
}

.payment-ribbon::after {
    right: 0;
    border-width: 5px 10px 0 0;
}

.ribbon-paid {
    background: linear-gradient(135deg, #04966a 0%, #05b57d 100%);
}

.ribbon-paid::before {
    border-color: transparent transparent transparent #036349;
}

.ribbon-paid::after {
    border-color: transparent #036349 transparent transparent;
}

.ribbon-partial {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
}

.ribbon-partial::before {
    border-color: transparent transparent transparent #cc8800;
}

.ribbon-partial::after {
    border-color: transparent #cc8800 transparent transparent;
}

.ribbon-unpaid {
    background: linear-gradient(135deg, #ff4450 0%, #ff6b75 100%);
}

.ribbon-unpaid::before {
    border-color: transparent transparent transparent #cc1a25;
}

.ribbon-unpaid::after {
    border-color: transparent #cc1a25 transparent transparent;
}

/* Payment Status Badges */
.payment-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.3px;
}

.status-paid {
    background: linear-gradient(135deg, #04966a 0%, #037550 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(4, 150, 106, 0.3);
}

.status-partial {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.status-unpaid {
    background: linear-gradient(135deg, #ff4450 0%, #dc3545 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 68, 80, 0.3);
}

/* Payment Summary Card */
.payment-summary-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* Payment Record Items */
.payment-record-item {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid #04966a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}

.payment-record-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateX(4px);
}

/* Toolbar Styling */
.toolbar-modern .btn {
    margin: 0.25rem;
}

/* ==================== Mobile Responsive ==================== */
@media (max-width: 768px) {
    .form-control, 
    .form-select, 
    .btn {
        min-height: 46px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ==================== Print Styles ==================== */
@media print {
    .hidden-print, 
    .toolbar-modern, 
    .payment-summary-card { 
        display: none !important; 
    }
}
