/* ======================================= */
/* ====== INVOICE PAGE STYLES START ====== */
/* ======================================= */

/* Invoice Container */
.invoice-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Invoice Header */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

/* Invoice Title */
.invoice-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

/* Invoice Details */
.invoice-details {
    text-align: right;
    min-width: 200px;
}

/* Form Sections */
.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 5px;
}

/* Form Groups */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 5px;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Invoice Table */
.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.invoice-table th,
.invoice-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.invoice-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.invoice-table input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 4px;
    font-size: 14px;
}

.invoice-table input:focus {
    background: #f9fafb;
    border-radius: 4px;
}

/* Invoice Totals */
.invoice-totals {
    margin-top: 20px;
    text-align: right;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.total-row.final {
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 3px double #374151;
    border-top: 1px solid #374151;
}

/* Base Button Styles */
.invoice-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    position: relative;
    overflow: hidden;
}

/* Button Hover Effects */
.invoice-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.invoice-actions .btn:active {
    transform: translateY(0);
}

/* Print Button */
.btn-print {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.btn-print:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
}

/* Calculate Button */
.btn-calculate {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.btn-calculate:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
}

/* Clear Button */
.btn-clear {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.btn-clear:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* Button Icons */
.btn-icon {
    font-size: 18px;
    line-height: 1;
    display: inline-block;
    flex-shrink: 0;
    filter: grayscale(100%);
}

/* Button Text */
.btn-text {
    font-weight: 600;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

/* Text Display Control */
.btn-text-full { display: inline; }
.btn-text-medium, .btn-text-mobile{ display: none; }
.btn-text-icon-only { display: inline; }

/* Desktop (769px+) */
@media (min-width: 769px) {
    .btn-text-full { display: inline; }
    .btn-text-medium, .btn-text-mobile{ display: none; }
    
    .invoice-actions {
        justify-content: flex-start;
        gap: 16px;
        margin-bottom: 24px;
    }
    
    .invoice-actions .btn {
        flex: none;
        min-width: 140px;
        max-width: 180px;
    }
}

/* Desktop Text Display */
.btn-text-desktop {
    display: inline;
}

.btn-text-mobile {
    display: none;
}

/* ===== FORM LAYOUT ENHANCEMENTS ===== */

/* Responsive form grid */
.invoice-form-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 769px) {
    .invoice-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .invoice-form-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* Input field styling for mobile */
@media (max-width: 480px) {
    .invoice-form input,
    .invoice-form textarea,
    .invoice-form select {
        width: 100%;
        max-width: 300px;
        margin: 0 auto 12px auto;
        padding: 12px;
        border-radius: 8px;
        border: 1px solid #d1d5db;
        text-align: center;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Table responsiveness */
@media (max-width: 480px) {
    .invoice-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 auto;
        max-width: 100%;
    }
    
    .invoice-table {
        min-width: 300px;
        margin: 0 auto;
    }
    
    .invoice-table th,
    .invoice-table td {
        min-width: 60px;
        padding: 8px 4px;
        font-size: 13px;
    }
}

/* ===== TABLET SCREENS (768px and below) ===== */
@media (max-width: 768px) {   
    /* Progressive Text Reduction: Show medium text */
    .btn-text-full {
        display: none;
    }
    
    .btn-text-medium, .btn-text-mobile{
        display: inline;
    }
    
    .btn-text-icon-only {
        display: none;
    }
    
    /* Button Layout Adjustments */
    .invoice-actions {
        gap: 10px;
        margin-bottom: 24px;
    }
    
    .invoice-actions .btn {
        min-width: 80px;
        max-width: 120px;
    }
    
    /* Form Alignment - Start centering */
    .invoice-items,
    .invoice-table-container {
        text-align: center;
    }
    
    .invoice-table {
        margin: 0 auto;
        max-width: 100%;
    }

    .company-info {
        justify-content: center;
    }
}

/* ===== SMALL SCREENS (480px and below) ===== */
@media (max-width: 480px) {
    /* Icons Only - Hide all text */
    .btn-text-full,
    .btn-text-medium, .btn-text-mobile{
        display: none;
    }
    
    .btn-icon {
        display: inline;
        font-size: 20px;
    }
    
    /* Button Layout for Mobile */
    .invoice-actions {
        flex-direction: row;
        gap: 8px;
        justify-content: center;
        margin-bottom: 20px;
    }
    
    .invoice-actions .btn {
        flex: 1;
        min-width: 60px;
        max-width: 80px;
        padding: 14px 8px;
        border-radius: 10px;
    }
    
    /* Center Justify Invoice Items Form */
    .invoice-items,
    .invoice-table-container,
    .invoice-form {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .invoice-table {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }
    
    /* Center form inputs */
    .invoice-form input,
    .invoice-form textarea,
    .invoice-form select {
        text-align: center;
        margin: 0 auto;
    }
    
    /* Center table content */
    .invoice-table td,
    .invoice-table th {
        text-align: center;
    }
    
    /* Center totals section */
    .invoice-totals {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin: 20px auto;
        max-width: 300px;
    }
}

/* ===== EXTRA SMALL SCREENS (320px and below) ===== */
@media (max-width: 320px) {
    .invoice-actions .btn {
        min-width: 50px;
        max-width: 70px;
        padding: 12px 6px;
        font-size: 12px;
    }
    
    .btn-icon {
        font-size: 18px;
    }
    
    /* Ultra-compact form layout */
    .invoice-items,
    .invoice-table-container {
        padding: 0 8px;
    }
    
    .invoice-table {
        font-size: 12px;
    }
    
    .invoice-table td,
    .invoice-table th {
        padding: 6px 4px;
    }
}

/* ===== DESKTOP SCREENS (769px and above) ===== */
@media (min-width: 769px) {
    /* Ensure full text is shown on desktop */
    .btn-text-full {
        display: inline;
    }
    
    .btn-text-medium,
    .btn-text-icon-only {
        display: none;
    }
    
    /* Desktop button layout */
    .invoice-actions {
        justify-content: flex-start;
        gap: 16px;
    }
    
    .invoice-actions .btn {
        flex: none;
        min-width: 140px;
        max-width: 180px;
    }
    
    /* Desktop form alignment */
    .invoice-items,
    .invoice-table-container {
        text-align: left;
    }
}


/* ===== INVOICE FORM MOBILE IMPROVEMENTS ===== */

/* Invoice Container */
.invoice-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Invoice Header */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

/* Invoice Title */
.invoice-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

/* Invoice Details */
.invoice-details {
    text-align: right;
    min-width: 200px;
}

/* Form Sections */
.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 5px;
}

/* Form Groups */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 5px;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Invoice Table */
.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.invoice-table th,
.invoice-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.invoice-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.invoice-table input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 4px;
    font-size: 14px;
}

.invoice-table input:focus {
    background: #f9fafb;
    border-radius: 4px;
}

/* Invoice Totals */
.invoice-totals {
    margin-top: 20px;
    text-align: right;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.total-row.final {
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 3px double #374151;
    border-top: 1px solid #374151;
}

/* ===== MOBILE RESPONSIVE INVOICE LAYOUT ===== */

@media (max-width: 768px) {
    .invoice-container {
        padding: 12px;
        margin: 8px;
        border-radius: 6px;
    }
    
    .invoice-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .invoice-title {
        font-size: 2rem;
    }
    
    .invoice-details {
        text-align: center;
        min-width: auto;
    }
    
    .form-section {
        margin-bottom: 25px;
    }
    
    .form-section h3 {
        font-size: 1.1rem;
    }
    
    .form-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .invoice-container {
        padding: 8px;
        margin: 4px;
    }
    
    .invoice-title {
        font-size: 1.8rem;
    }
    
    .form-section h3 {
        font-size: 1rem;
    }
    
    /* Make table scrollable horizontally */
    .table-container {
        overflow-x: auto;
        margin: 15px 0;
        border-radius: 6px;
        border: 1px solid #e5e7eb;
    }
    
    .invoice-table {
        min-width: 500px;
        font-size: 12px;
    }
    
    .invoice-table th,
    .invoice-table td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    .invoice-totals {
        font-size: 14px;
    }
    
    .total-row {
        padding: 6px 0;
    }
    
    .total-row.final {
        font-size: 1rem;
    }
}

@media (max-width: 320px) {
    .invoice-title {
        font-size: 1.6rem;
    }
    
    .invoice-table {
        font-size: 11px;
    }
    
    .invoice-table th,
    .invoice-table td {
        padding: 6px 4px;
    }
    
    .form-input {
        padding: 10px;
    }
}

/* ===== DESKTOP SCREENS (769px and above) ===== */
@media (min-width: 769px) {
    /* Ensure full text is shown on desktop */
    .btn-text-full {
        display: inline;
    }
    
    .btn-text-medium,
    .btn-text-icon-only {
        display: none;
    }
    
    /* Desktop button layout */
    .invoice-actions {
        justify-content: flex-start;
        gap: 16px;
    }
    
    .invoice-actions .btn {
        flex: none;
        min-width: 140px;
        max-width: 180px;
    }
    
    /* Desktop form alignment */
    .invoice-items,
    .invoice-table-container {
        text-align: left;
    }
}


/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* Focus styles for keyboard navigation */
.invoice-actions .btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .invoice-actions .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .invoice-actions .btn {
        transition: none;
    }
    
    .invoice-actions .btn:hover {
        transform: none;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .invoice-actions .btn {
        transition: none;
    }
    
    .invoice-actions .btn:hover {
        transform: none;
    }
}



.invoice-layout-body {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.4;
    color: var(--text-primary);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    border-bottom: 2px solid #2c5aa0;
    padding-bottom: 20px;
}

.company-info {
    flex: 1;
}

.company-name {
    font-size: 24px;
    font-weight: bold;
    color: #2c5aa0;
    margin-bottom: 5px;
}

.invoice-title {
    text-align: right;
    flex: 1;
}

.invoice-title h1 {
    font-size: 32px;
    color: #2c5aa0;
    margin: 0;
}

.invoice-details {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

.bill-to, .invoice-info {
    flex: 1;
}

.bill-to {
    margin-right: 40px;
}

.section-title {
    font-weight: bold;
    color: #2c5aa0;
    margin-bottom: 10px;
    font-size: 14px;
    text-transform: uppercase;
}

.editable {
    border: 1px dashed #ccc;
    padding: 5px;
    min-height: 20px;
    background-color: #f9f9f9;
    margin-bottom: 5px;
}

.editable:focus {
    outline: 2px solid #2c5aa0;
    background-color: white;
}

.services-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.services-table th,
.services-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.services-table th {
    background-color: #2c5aa0;
    color: white;
    font-weight: bold;
}

.services-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.totals {
    float: right;
    width: 300px;
    margin-top: 20px;
}

.totals table {
    width: 100%;
    border-collapse: collapse;
}

.totals td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
}

.totals .total-label {
    font-weight: bold;
    text-align: right;
    width: 60%;
}

.totals .total-amount {
    text-align: right;
    width: 40%;
}

.totals .final-total {
    font-size: 18px;
    font-weight: bold;
    color: #2c5aa0;
    border-top: 2px solid #2c5aa0;
    border-bottom: 2px solid #2c5aa0;
}

.payment-terms {
    clear: both;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

@media print {
    body { 
        margin: 0; 
    }
    
    .no-print { 
        display: none; 
    }

    .invoice-layout-body { 
        margin: 0; 
    }
}
/* ===== INVOICE PAGE STYLES END ===== */
/* =================================== */
