/* Invoice Generator V2 Styles */
.invoice-screen {
    min-height: 100vh;
    padding: 100px 0 40px;
    display: none;
}

.invoice-screen.active {
    display: block;
}

.screen-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.screen-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.screen-content h2 {
    font-size: 2rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 30px;
}

.subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 40px;
}

/* Country Selection */
.country-selection {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-control:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
}

/* Privacy Notice */
.privacy-notice {
    background: #e8f5e8;
    border: 1px solid #28a745;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.privacy-notice h3 {
    color: #155724;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.privacy-notice ul {
    list-style: none;
    padding: 0;
}

.privacy-notice li {
    padding: 5px 0;
    color: #155724;
}

/* Mode Selection */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.mode-card {
    background: #fff;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-card:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.mode-card.selected {
    border-color: #007bff;
    background: #f8f9ff;
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.mode-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.mode-card p {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

.mode-actions {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

/* Editor Styles */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.country-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.invoice-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-link {
    background: none;
    border: none;
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
}

.form-section {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

.form-section h3 {
    margin-bottom: 20px;
    color: #1a1a1a;
    font-size: 1.1rem;
}

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

/* Image Uploads */
.image-upload-wrapper {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #e1e5e9;
}

.image-preview-container {
    margin-top: 10px;
    display: none;
    align-items: center;
    gap: 15px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.preview-img {
    max-height: 50px;
    max-width: 100px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
}

.btn-remove-img {
    background: #ff4757;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-remove-img:hover {
    background: #ff6b81;
}

/* Line Items */
.line-items-container {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
}

.line-items-header {
    display: grid;
    grid-template-columns: 2.5fr 1fr 0.8fr 0.8fr 0.8fr 1fr 50px;
    background: #f8f9fa;
    padding: 15px;
    font-weight: 600;
    border-bottom: 1px solid #e1e5e9;
    gap: 8px;
    align-items: center;
}

.line-item {
    display: grid;
    grid-template-columns: 2.5fr 1fr 0.8fr 0.8fr 0.8fr 1fr 50px;
    padding: 15px;
    border-bottom: 1px solid #e1e5e9;
    align-items: center;
    gap: 8px;
}

.line-item:last-child {
    border-bottom: none;
}

.line-item input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

.line-item input:focus {
    outline: none;
    border-color: #007bff;
}

.line-item .amount-input {
    background: #fff;
    font-weight: 500;
    color: #333;
}

.line-item .btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.line-item .btn-remove:hover {
    background: #c82333;
}

.line-items-actions {
    padding: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    background: #f8f9fa;
    flex-wrap: wrap;
}

.btn-link {
    background: none;
    border: none;
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
}

.btn-link:hover {
    color: #0056b3;
}

/* Totals */
.totals-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
    margin-left: auto;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 16px;
}

.grand-total {
    font-weight: 600;
    font-size: 18px;
    color: #1a1a1a;
    border-top: 2px solid #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

/* Accordion */
.accordion-item {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-toggle {
    width: 100%;
    background: #f8f9fa;
    border: none;
    padding: 15px 20px;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    transition: background 0.3s ease;
}

.accordion-toggle:hover {
    background: #e9ecef;
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.accordion-item.active .accordion-content {
    padding: 20px;
    max-height: 1000px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* Preview */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.preview-actions {
    display: flex;
    gap: 15px;
}

.invoice-preview {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .mode-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .line-items-header {
        grid-template-columns: 2fr 1fr;
        gap: 5px;
        font-size: 12px;
        padding: 10px;
    }

    .line-items-header .col-hsn,
    .line-items-header .col-tax,
    .line-items-header .col-amount,
    .line-items-header .col-actions {
        display: none;
    }

    .line-item {
        grid-template-columns: 2fr 1fr 40px;
        gap: 5px;
        padding: 10px;
    }

    .line-item .item-hsn,
    .line-item .item-tax,
    .line-item .amount-input {
        display: none;
    }

    .editor-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .preview-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .form-actions {
        flex-direction: column;
    }

    .mode-actions {
        flex-direction: column;
    }

    .line-items-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .line-items-header {
        grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
        gap: 6px;
    }

    .line-items-header .col-actions {
        display: none;
    }

    .line-item {
        grid-template-columns: 2fr 1fr 1fr 1fr 1fr 40px;
        gap: 6px;
    }

    .line-item .item-hsn {
        display: none;
    }
}

/* Print Styles */
@media print {

    /* Hide browser default headers and footers */
    @page {
        margin: 0.5in;
        size: auto;
    }

    /* Hide everything by default */
    body>* {
        display: none !important;
    }

    /* Only show the key parts */
    body {
        background: white;
        margin: 0;
        padding: 0;
    }

    main,
    #screen-preview,
    .container {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }

    /* Ensure preview content is visible and takes full width */
    #invoice-preview-content {
        display: block !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    /* Specifically hide UI elements in the preview screen */
    .preview-header,
    .preview-actions,
    .header,
    .nav,
    .form-actions {
        display: none !important;
    }

    /* Reset some screen specific styles that might interfere */
    .invoice-screen {
        padding: 0 !important;
        min-height: auto !important;
    }

    /* Ensure styles inside the preview are good for print */
    .invoice-document {
        padding: 20px !important;
        max-width: 100% !important;
        position: relative;
        min-height: calc(100vh - 1in);
    }

    /* Add custom footer */
    .invoice-document::after {
        content: "www.moneylense.com";
        display: block;
        text-align: center;
        font-size: 10px;
        color: #666;
        margin-top: 40px;
        padding-top: 20px;
        border-top: 1px solid #ddd;
    }
}