/* Basic Reset & Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #f0f2f5 0%, #e8ecf2 100%); /* Beautiful gradient background */
    color: #333;
    font-size: 14px; /* Base font size */
    min-height: 100vh;
}

textarea,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 1em;
    padding: 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    transition: all 0.3s ease;
    width: 100%;
}

textarea:focus,
input:focus,
select:focus {
    border-color: #4A90E2; /* Highlight focus */
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    transform: translateY(-1px);
}

button {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 4px;
    border: none;
    font-size: 0.95em;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

button:active {
    transform: translateY(0);
}

/* App Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background-color: #3A3F4B; /* Dark header */
    color: #fff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.site-branding {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.site-branding .logo-placeholder {
    font-size: 1.5em;
    font-weight: bold;
}
.site-branding .site-description {
    font-size: 0.8em;
    opacity: 0.8;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-controls h1 {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 1.6em;
    font-weight: 500;
    margin: 0;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.doc-type-selector {
    display: flex;
    gap: 15px;
}

.doc-type-selector label {
    cursor: pointer;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.doc-type-selector input[type="radio"] { 
    margin-right: 5px; 
}

.language-currency-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.language-selector,
.currency-selector,
.date-format-selector {
    display: flex;
    align-items: center;
    gap: 5px;
}

.language-selector label,
.currency-selector label,
.date-format-selector label {
    font-size: 1.2em;
    cursor: pointer;
}

.language-selector select,
.currency-selector select,
.date-format-selector select {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.9em;
    min-width: 120px;
    cursor: pointer;
}

.language-selector select:focus,
.currency-selector select:focus,
.date-format-selector select:focus {
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
}

.language-selector option,
.currency-selector option,
.date-format-selector option {
    background: #3A3F4B;
    color: white;
}

.app-main {
    flex-grow: 1;
    display: flex;
    padding: 20px; /* Overall padding for main area */
    gap: 20px;
    overflow: auto; /* if content overflows */
}

.invoice-workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.invoice-controls-toolbar {
    background-color: #fff;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}
.template-controls label { font-weight: 500; margin-right: 5px;}
#pdf-template-select { padding: 8px; border-radius: 4px; border: 1px solid #ccc; }
.paid-stamp-label { display: flex; align-items: center; cursor: pointer; font-weight: normal !important;}
.paid-stamp-label input[type="checkbox"] { margin-right: 5px; }

#download-pdf {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
    font-weight: 500;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

#download-pdf:hover { 
    background: linear-gradient(135deg, #357ABD 0%, #2968A3 100%);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.3);
}

#download-pdf:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

#download-pdf.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s ease infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

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

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4A90E2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Invoice Paper Styling */
.invoice-paper {
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    padding: 40px; /* Generous padding like real paper */
    border-radius: 8px; /* More pronounced rounding */
    box-shadow: 
        0 10px 25px rgba(0,0,0,0.08),
        0 20px 48px rgba(0,0,0,0.04),
        0 1px 4px rgba(0,0,0,0.05);
    max-width: 800px; /* Typical A4-ish width */
    margin: 0 auto; /* Center the paper in the workspace */
    width: 100%; /* Ensure it takes up workspace width if workspace is narrower */
    border: 1px solid rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
}

.invoice-paper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4A90E2, #357ABD, #4A90E2);
}

/* General Invoice Section Styling */
.invoice-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9e9e9; /* Separator lines */
}
.invoice-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.invoice-section h3 {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 1.1em;
    font-weight: 500;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-section-button {
    background: none;
    border: 1px solid #ccc;
    padding: 2px 6px;
    font-size: 0.9em;
    margin-left: 10px;
    color: #555;
}
.toggle-section-button:hover { background-color: #f0f0f0; }

.reset-button {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #ced4da;
    padding: 5px 10px;
    font-size: 0.85em;
}
.reset-button:hover { background-color: #e9ecef; }

.reset-button.mini-reset {
    padding: 3px 8px;
    font-size: 0.8em;
    margin-left: 10px;
}

.reset-button.bottom-reset {
    display: block; /* Make it full width or align as needed */
    margin-top: 15px;
    /* text-align: right; float:right; */ /* If you want it on the right */
}

.section-content div {
    margin-bottom: 8px;
}
.section-content.collapsed { display: none; }

/* Specific Section Layouts */
.invoice-header-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    min-height: 80px; /* Ensure space even if no logo */
}

.company-logo-area {
    flex: 1;
}
#company-logo-upload {
    display: none; /* Hide default input, use label */
}
.file-upload-label {
    display: inline-block;
    padding: 8px 12px;
    background-color: #f0f0f0;
    border: 1px dashed #ccc;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 10px;
}
.file-upload-label:hover { background-color: #e9e9e9; }
#company-logo-preview {
    max-width: 180px;
    max-height: 70px;
    display: block; /* Was none, now block to take space when src is set */
    margin-bottom: 5px; /* Space before reset button */
    border: 1px solid #eee;
}

.invoice-title-area {
    flex: 1;
    text-align: right;
}
#invoice-type-display {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 2.2em;
    font-weight: 700;
    color: #222;
    margin: 0;
    line-height: 1;
}

.top-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px; /* More gap between these sections */
}

.your-company-details, .client-billing-details {
    /* No border on these as they are part of the paper look */
}

.client-management-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.client-management-controls select { flex-grow: 1; }
.client-management-controls button {
     padding: 8px 12px;
     background-color: #6c757d;
     color: white;
     font-size: 0.9em;
     border-radius: 4px;
}
.client-management-controls button:hover { background-color: #5a6268; }

.company-management-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.company-management-controls select { flex-grow: 1; }
.company-management-controls button {
     padding: 8px 12px;
     background-color: #6c757d;
     color: white;
     font-size: 0.9em;
     border-radius: 4px;
}
.company-management-controls button:hover { background-color: #5a6268; }

#edit-client-button {
    background-color: #4A90E2 !important;
}
#edit-client-button:hover {
    background-color: #357ABD !important;
}

#edit-company-button {
    background-color: #4A90E2 !important;
}
#edit-company-button:hover {
    background-color: #357ABD !important;
}

.invoice-document-meta .meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-top: 10px;
}

.invoice-document-meta label {
    font-weight: 500;
    margin-bottom: 5px;
    display: block;
    color: #333;
}

/* Date format hints */
.date-format-hint {
    display: inline-block;
    margin-left: 8px;
    color: #666;
    font-size: 0.8em;
    font-style: italic;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.date-format-hint:hover {
    opacity: 1;
    color: #4A90E2;
}

/* Date input container styling */
.invoice-document-meta .meta-grid > div {
    display: flex;
    flex-direction: column;
    position: relative;
}

.invoice-document-meta input[type="date"] {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
}

.invoice-document-meta input[type="date"]:focus {
    border-color: #4A90E2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

/* Items Table */
#invoice-items table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px; /* Space from h3 */
}
#invoice-items th, #invoice-items td {
    border: 1px solid #e0e0e0;
    padding: 8px;
    text-align: left;
    vertical-align: top;
    position: relative;
}
#invoice-items th {
    background-color: #f9f9f9;
    font-weight: 500;  
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* Fix input styling within table cells */
#invoice-items td input[type="number"], 
#invoice-items td textarea {
    border: 1px solid #ddd;
    font-size: 0.95em;
    width: 100%;
    box-sizing: border-box;
    background: white;
    position: relative;
    z-index: 1;
}

/* Specific fixes for number inputs */
#invoice-items td input[type="number"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
    text-align: right;
    padding: 6px 8px;
    border-radius: 3px;
}

/* Remove number input spinners on webkit browsers */
#invoice-items td input[type="number"]::-webkit-outer-spin-button,
#invoice-items td input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Column widths and alignment */
#invoice-items th.qty, #invoice-items td:nth-child(2) { 
    width: 10%; 
    text-align: center; 
    min-width: 80px;
}
#invoice-items th.unit-price, #invoice-items td:nth-child(3) { 
    width: 15%; 
    text-align: right; 
    min-width: 100px;
}
#invoice-items th.tax, #invoice-items td:nth-child(4) { 
    width: 10%; 
    text-align: right; 
    min-width: 80px;
}
#invoice-items th.line-total, #invoice-items td:nth-child(5) { 
    width: 15%; 
    text-align: right; 
    font-weight: 500;
    min-width: 100px;
}
#invoice-items th.actions, #invoice-items td:nth-child(6) { 
    width: 10%; 
    text-align: center;
    min-width: 80px;
}

/* Description column takes remaining space */
#invoice-items th:first-child, #invoice-items td:first-child {
    width: 40%;
    min-width: 150px;
}

#invoice-items .remove-item-row {
    background-color: #ffc107; 
    color: #333; 
    font-size: 0.85em; 
    padding: 5px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}
#invoice-items .remove-item-row:hover { 
    background-color: #e0a800; 
}

#add-item-row {
    background-color: #5cb85c; 
    color: white; 
    margin-top: 15px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
#add-item-row:hover { 
    background-color: #4cae4c; 
}

/* Summary Section */
.summary-section .summary-grid {
    display: grid;
    grid-template-columns: auto auto; /* Label and value */
    justify-content: flex-end; /* Align grid to the right */
    gap: 8px 15px;
    margin-top: 10px;
}
.summary-section label { font-weight: 500; text-align: right; }
.summary-section .summary-value { font-weight: 500; text-align: right; }
.summary-section input[type="number"], .summary-section select { max-width: 90px; }
.summary-section .calculated-amount { text-align: right; color: #666; font-size: 0.9em; }
.summary-section .grand-total-container {
    grid-column: 1 / -1; margin-top: 10px; padding-top: 10px;
    border-top: 2px solid #333;
    display: flex; justify-content: space-between; align-items: center;
}
.summary-section .grand-total-container label { font-size: 1.3em; font-weight: bold; color: #333; }
.summary-section .grand-total { font-size: 1.6em; font-weight: bold; color: #4A90E2; }

/* Payment and T&C */
.bottom-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}
.payment-info-section textarea, .terms-info-section textarea {
    min-height: 120px;
}

/* App Sidebar & Footer */
.app-sidebar {
    width: 280px; /* Fixed width for sidebar */
    flex-shrink: 0;
}

/* Support Section Styles */
.support-section {
    background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
    border: 2px solid #f0c14b;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(240, 193, 75, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.support-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(240, 193, 75, 0.25);
}

.support-section h3 {
    color: #4A90E2;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 12px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.support-section p {
    color: #555;
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 15px;
    font-weight: 400;
}

.coffee-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.coffee-button-container a {
    display: inline-block;
    transition: transform 0.2s ease;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.coffee-button-container a:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.coffee-button-container img {
    display: block;
    border-radius: 8px;
}

.ads-placeholder {
    margin: 20px 0;
    padding: 0;
    min-height: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    display: block;
    position: relative;
}

/* Only show placeholder styling when container is truly empty after loading */
.ads-placeholder:empty {
    min-height: 250px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.ads-placeholder:empty::after {
    content: "Advertisement Space";
    color: #6c757d;
    font-size: 0.9em;
    font-style: italic;
}

.ads-placeholder ins.adsbygoogle {
    background: transparent !important;
    border: none !important;
}

/* Mobile-only ads - hidden on desktop */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    /* Adjust ad placeholder sizes for mobile */
    .ads-placeholder {
        min-height: 200px;
        margin: 15px 0;
    }
    
    /* Bottom ad responsive styles */
    .bottom-ad-container {
        margin: 15px auto;
        padding: 10px;
        max-width: 100%;
        min-height: 120px;
    }
    
    .bottom-ad-container ins.adsbygoogle {
        min-height: 100px;
    }
}

/* Ensure ads don't break layout */
.adsbygoogle {
    display: block !important;
    max-width: 100%;
    overflow: hidden;
}

/* Bottom Ad Container */
.bottom-ad-container {
    margin: 20px auto;
    padding: 0;
    max-width: 728px;
    background: transparent;
    border: none;
    border-radius: 0;
    display: block;
}

.bottom-ad-container:empty {
    min-height: 90px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.bottom-ad-container:empty::after {
    content: "Footer Advertisement Space";
    color: #6c757d;
    font-size: 0.9em;
    font-style: italic;
}

.bottom-ad-container ins.adsbygoogle {
    background: transparent !important;
    border: none !important;
    min-height: 90px;
}

.app-footer {
    text-align: center;
    padding: 20px;
    background-color: #3A3F4B;
    color: #ccc;
    font-size: 0.9em;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    position: relative;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.modal-content h3 {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3em;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

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

.modal-content div {
    margin-bottom: 15px;
}

.modal-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.modal-content button {
    background-color: #4A90E2;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    font-size: 14px;
}

.modal-content button:hover {
    background-color: #357ABD;
}

#delete-client-button {
    background-color: #f44336 !important;
}

#delete-client-button:hover {
    background-color: #d32f2f !important;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .invoice-paper { padding: 20px; }
    .top-details-grid, .bottom-details-grid {
        grid-template-columns: 1fr; /* Stack on smaller screens */
        gap: 20px;
    }
    .summary-section .summary-grid { justify-content: stretch; grid-template-columns: auto 1fr; }
    
    /* Better table handling on tablet */
    #invoice-items table {
        font-size: 0.9em;
    }
    #invoice-items th, #invoice-items td {
        padding: 6px 4px;
    }
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 15px 20px;
    }
    
    .site-branding {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .professional-logo {
        max-width: 320px;
        margin-bottom: 8px;
    }
    
    .text-logo {
        font-size: 1.4em;
    }
    
    .header-info {
        padding: 0;
        margin: 0;
        width: 100%;
    }
    
    .tool-description {
        font-size: 0.8em;
        line-height: 1.3;
        margin: 0;
    }
    
    .header-controls {
        width: 100%;
    }
    
    .controls-row {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    .language-currency-controls {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .language-selector,
    .currency-selector,
    .date-format-selector {
        width: 100%;
    }
    
    .language-selector select,
    .currency-selector select,
    .date-format-selector select {
        width: 100%;
        min-width: auto;
    }
    
    .app-main {
        flex-direction: column;
        padding: 15px;
    }
    .app-sidebar {
        width: 100%;
        order: 1; /* Move sidebar below invoice on mobile */
    }
    .invoice-workspace {
        order: 0;
    }
    
    /* Support section mobile styles */
    .support-section {
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .support-section h3 {
        font-size: 1.1em;
    }
    
    .support-section p {
        font-size: 0.85em;
    }
    
    .coffee-button-container img {
        height: 50px !important;
        width: auto !important;
        max-width: 100%;
    }
    
    /* Mobile table improvements */
    #invoice-items {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #invoice-items table {
        min-width: 600px; /* Prevent table from becoming too cramped */
        font-size: 0.85em;
    }
    
    #invoice-items th, #invoice-items td { 
        padding: 4px 2px; 
        font-size: 0.85em; 
    }
    
    #invoice-items td input[type="number"] {
        padding: 4px 6px;
        font-size: 0.85em;
    }
    
    #invoice-items textarea { 
        min-height: 40px;
        font-size: 0.85em;
        padding: 4px 6px;
    }
    
    #invoice-items .remove-item-row {
        padding: 3px 6px;
        font-size: 0.8em;
    }
    
    /* Mobile-specific column widths */
    #invoice-items th:first-child, #invoice-items td:first-child {
        min-width: 120px;
    }
    #invoice-items th.qty, #invoice-items td:nth-child(2) { 
        min-width: 60px;
    }
    #invoice-items th.unit-price, #invoice-items td:nth-child(3) { 
        min-width: 80px;
    }
    #invoice-items th.tax, #invoice-items td:nth-child(4) { 
        min-width: 60px;
    }
    #invoice-items th.line-total, #invoice-items td:nth-child(5) { 
        min-width: 80px;
    }
    #invoice-items th.actions, #invoice-items td:nth-child(6) { 
        min-width: 60px;
    }
    
    /* Summary adjustments for mobile */
    .summary-section .summary-grid {
        gap: 5px 10px;
        font-size: 0.9em;
    }
    
    .summary-section input[type="number"], 
    .summary-section select { 
        max-width: 70px;
        font-size: 0.85em;
    }
    
    /* Modal improvements for mobile */
    .modal-content {
        margin: 2% auto;
        padding: 20px;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .about-modal-content {
        max-width: 95%;
        max-height: 85vh;
    }
    
    .professional-logo {
        max-width: 280px;
    }
    
    .text-logo {
        font-size: 1.4em;
    }
    
    .site-branding {
        margin-bottom: 10px;
    }
    
    /* Header info mobile styles */
    .header-info {
        padding: 0 15px;
        margin: 8px 0;
    }
    
    .tool-description {
        font-size: 0.8em;
        line-height: 1.3;
        margin-bottom: 4px;
    }
    
    .about-hint {
        font-size: 0.75em;
        margin-top: 3px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .invoice-paper {
        padding: 15px;
        border-radius: 4px;
    }
    
    .header-controls h1 {
        font-size: 1.3em;
    }
    
    #invoice-type-display {
        font-size: 1.8em;
    }
    
    .invoice-controls-toolbar {
        padding: 10px;
    }
    
    #download-pdf {
        width: 100%;
        padding: 15px;
        font-size: 1.1em;
    }
    
    /* Extra small table adjustments */
    #invoice-items table {
        min-width: 500px;
    }
    
    #invoice-items th, #invoice-items td {
        padding: 3px 1px;
        font-size: 0.8em;
    }
    
    #invoice-items td input[type="number"],
    #invoice-items textarea {
        font-size: 0.8em;
        padding: 3px 4px;
    }
}

/* About Button */
.about-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.about-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* About Modal Specific Styles */
.about-modal-content {
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
}

.about-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.about-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.about-section h4 {
    color: #4A90E2;
    margin-bottom: 10px;
    font-size: 1.1em;
    font-weight: 600;
}

.about-section p {
    line-height: 1.6;
    color: #555;
    margin-bottom: 10px;
}

.about-section ul,
.about-section ol {
    padding-left: 20px;
    color: #555;
    line-height: 1.6;
}

.about-section li {
    margin-bottom: 8px;
}

.about-section ul li {
    list-style-type: none;
    position: relative;
}

.about-section ol li {
    margin-bottom: 6px;
}

/* Contact Links Styling */
.contact-links {
    margin-top: 15px;
}

.instagram-link {
    display: inline-block;
    background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 1em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.instagram-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    color: white;
}

/* Professional Logo Styles */
.professional-logo {
    display: flex;
    align-items: center;
    max-width: 520px;
    margin-bottom: 8px;
}

.professional-logo img {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.professional-logo img:hover {
    transform: scale(1.05);
}

/* Header Info Section */
.header-info {
    margin: 0;
    padding: 0;
    text-align: left;
}

.tool-description {
    color: #e8f3ff;
    font-size: 0.85em;
    line-height: 1.4;
    margin: 0;
    opacity: 0.9;
}

.about-hint {
    color: #666;
    font-size: 0.85em;
    margin-top: 5px;
    margin-bottom: 0;
}

.about-link:hover {
    color: #3875D7 !important;
    text-decoration: none !important;
}

/* Text-based logo fallback */
.text-logo {
    display: none; /* Hidden by default, shown if SVG fails */
    color: #ffffff;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.8em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.text-logo .brand-name {
    background: linear-gradient(135deg, #ffffff, #e8f3ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-logo .brand-tagline {
    font-size: 0.6em;
    font-weight: 400;
    opacity: 0.9;
    margin-top: -5px;
    color: #e8f3ff;
}

/* Fallback for when SVG logo doesn't load */
.professional-logo img:not([src]), .professional-logo img[src=""] {
    display: none;
}

@media (max-width: 768px) {
    .professional-logo {
        max-width: 280px;
    }
    
    .text-logo {
        font-size: 1.4em;
    }
    
    .site-branding {
        margin-bottom: 10px;
    }
    
    .header-info {
        padding: 0 15px;
        margin: 8px 0;
    }
    
    .tool-description {
        font-size: 0.8em;
        line-height: 1.3;
        margin-bottom: 4px;
    }
    
    .about-hint {
        font-size: 0.75em;
        margin-top: 3px;
    }
}

/* Contact Section Styles */
.contact-section {
    background: linear-gradient(135deg, #e6f3ff 0%, #f0f8ff 100%);
    border: 2px solid #4A90E2;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.25);
}

.contact-section h3 {
    color: #4A90E2;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 12px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.contact-section p {
    color: #555;
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 15px;
    font-weight: 400;
}

.contact-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.contact-button-container a {
    display: inline-block;
    transition: transform 0.2s ease;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.contact-button-container a:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Main page Instagram button - slightly different styling */
.instagram-link.main-page-instagram {
    font-size: 0.95em;
    padding: 10px 18px;
    border-radius: 6px;
}

/* Mobile Ad Container - Only visible on mobile devices */
.mobile-ad-container {
    display: none; /* Hidden by default on desktop */
    background-color: #fff;
    padding: 15px;
    margin: 20px 0;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
}

.mobile-ad-container ins.adsbygoogle {
    display: block;
    min-height: 250px; /* Minimum height for mobile ads */
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

/* Show mobile ad only on mobile devices */
@media (max-width: 768px) {
    .mobile-ad-container {
        display: block;
        margin: 20px 15px; /* Add side margins on mobile */
    }
    
    /* Adjust sidebar ads spacing on mobile when sidebar is moved to bottom */
    .ads-placeholder {
        margin: 15px 0;
    }
} 