* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    padding: 20px;
    color: #000;
}

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

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 80%;
    max-width: 900px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.modal-header {
    background-color: #0066cc;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #e6e6e6;
    text-decoration: none;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.table-wrapper {
    max-height: 500px;
    overflow-y: auto;
    margin-top: 15px;
    border: 1px solid #ddd;
}

#detailsTable {
    width: 100%;
    border-collapse: collapse;
}

#detailsTable th, #detailsTable td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#detailsTable th {
    background-color: #f2f2f2;
    position: sticky;
    top: 0;
}

.action-btn {
    background-color: #28a745;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.action-btn:hover {
    background-color: #218838;
}

.details-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    margin-left: 8px;
    color: #0066cc;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* PDF-style Header */
.pdf-header {
    background: white;
    padding: 30px;
    border-bottom: 3px solid #0066cc;
}

.header-logos {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.logo-aade {
    text-align: left;
}

.logo-text {
    font-size: 20px;
    font-weight: bold;
    color: #003366;
}

.logo-subtext {
    font-size: 10px;
    color: #666;
    line-height: 1.3;
}

.logo-greece {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    color: #003366;
}

.logo-mydata {
    font-size: 32px;
    font-weight: bold;
    color: #0066cc;
    font-style: italic;
}

.pdf-header h1 {
    font-size: 18px;
    text-align: center;
    color: #0066cc;
    margin: 20px 0;
    line-height: 1.4;
}

.header-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.taxpayer-info {
    display: flex;
    gap: 30px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.info-item {
    display: flex;
    gap: 8px;
}

.info-label {
    font-weight: 600;
    color: #333;
}

.info-value {
    color: #000;
    font-weight: 700;
}

/* Controls */
.controls {
    background: #e9ecef;
    padding: 20px 30px;
    border-bottom: 2px solid #ddd;
}

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

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-group label {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.input-group input,
.input-group select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: #0066cc;
    color: white;
}

.btn-primary:hover {
    background: #0052a3;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

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

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

.loading {
    color: #0066cc;
    font-weight: 600;
    padding: 10px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 20px;
    border-radius: 4px;
    border-left: 4px solid #f5c6cb;
    flex: 1;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 12px 20px;
    border-radius: 4px;
    border-left: 4px solid #c3e6cb;
    flex: 1;
}

.record-count {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: white;
    border-radius: 4px;
    border: 2px solid #0066cc;
}

.count-label {
    font-weight: 600;
    color: #0066cc;
}

.count-value {
    font-weight: 700;
    font-size: 1.2em;
    color: #000;
}

/* Form Container */
#formContainer {
    padding: 30px;
}

/* Form Sections */
.form-section {
    margin-bottom: 40px;
    page-break-inside: avoid;
}

.section-title {
    background: #0066cc;
    color: white;
    padding: 10px 15px;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
}

.income-section .section-title {
    background: #0066cc;
}

.expense-section .section-title {
    background: #0066cc;
}

.category-section .section-title {
    background: #006633;
}

.field561-section {
    border-left: 4px solid #0099cc;
}

.field581-section {
    border-left: 4px solid #cc6600;
}

.field585-section {
    border-left: 4px solid #ff6600;
}

.table-title {
    font-size: 14px;
    font-weight: bold;
    color: #003366;
    margin-bottom: 10px;
}

.table-subtitle {
    font-size: 13px;
    font-weight: bold;
    color: #0066cc;
    margin-bottom: 15px;
    padding: 8px 12px;
    background: #e7f3ff;
    border-left: 4px solid #0066cc;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: white;
    border: 1px solid #ddd;
}

.e3-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.e3-table thead {
    background: #0066cc;
    color: white;
}

.e3-table th {
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #0052a3;
}

.e3-table td {
    padding: 8px 10px;
    border: 1px solid #ddd;
}

.e3-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.e3-table tbody tr:hover {
    background: #e7f3ff;
}

.col-code {
    width: 120px;
    text-align: left;
}

.col-subcode {
    width: 100px;
    text-align: center;
}

.col-category {
    width: 120px;
    text-align: left;
}

.col-classification {
    width: 150px;
    text-align: left;
}

.col-description {
    width: 40%;
}

.col-mydata, .col-e3, .col-diff {
    width: 140px;
    text-align: right;
}

.col-category {
    width: 25%;
    text-align: left;
}

.field-code {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #003366;
}

.field-description {
    color: #000;
}

.field-amount {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #000;
}

.no-data {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 30px !important;
}

/* Table Footer */
.e3-table tfoot {
    background: #f8f9fa;
    border-top: 2px solid #0066cc;
}

.e3-table tfoot td {
    padding: 12px 10px;
    font-weight: bold;
    border: 1px solid #ddd;
}

.total-row {
    background: #e7f3ff;
}

.total-row td {
    font-weight: bold;
    font-size: 14px;
}

.amount {
    text-align: right;
    font-family: 'Courier New', monospace;
}

/* Delta Table Specific Styles */
.delta-toggle-icon {
    display: inline-block;
    width: 1em;
    font-size: 0.7em;
    color: #0056b3;
    user-select: none;
}

.table-delta tr[data-group] td {
    background-color: #f9f9f9;
}

.table-delta th {
    text-align: center;
    vertical-align: middle;
    font-size: 12px;
}

.col-field-num {
    width: 50px;
    text-align: center;
}

.col-activity {
    width: 120px;
    text-align: center;
}

.field-num {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #666;
}

.field-row-bold {
    font-weight: bold;
    background: #e7f3ff !important;
}

.field-row-bold.field-amount {
    color: #003366;
}

/* Indentation for nested rows */
.indent-1 {
    padding-left: 20px !important;
}

.indent-2 {
    padding-left: 40px !important;
}

.indent-3 {
    padding-left: 60px !important;
}

/* Field 561 breakdown specific styles */
.subcategory-header-row {
    background: #e7f3ff !important;
    font-weight: bold;
}

.category-detail-row {
    background: #f8f9fa !important;
}

.category-detail-row td {
    font-size: 12px;
}

.category-code {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #0066cc;
}

/* ΠΙΝΑΚΑΣ Ζ΄ Styles */
.zprime-header {
    background: #0066cc;
    color: white;
    padding: 10px 15px;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-zero-rows-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    color: white;
    padding: 3px 10px;
    opacity: 0.7;
    line-height: 1.4;
    flex-shrink: 0;
}

.toggle-zero-rows-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.toggle-zero-rows-btn.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.zprime-section-header td {
    background: #e7f3ff;
    color: #003366;
    padding: 8px 10px;
    font-weight: bold;
    font-size: 13px;
    border-top: 2px solid #0066cc;
    border-bottom: 1px solid #b3d4f0;
}

/* Modal Filters */
.modal-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    padding: 12px 0 16px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 12px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 130px;
}

.filter-group label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.filter-range {
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-range input {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    width: 120px;
}

.filter-range input[type="number"] {
    width: 90px;
}

.filter-range input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
}

.filter-range span {
    color: #888;
    flex-shrink: 0;
}

.filter-clear {
    justify-content: flex-end;
    min-width: auto;
}

/* Multiselect Dropdown */
.multiselect {
    position: relative;
}

.multiselect-btn {
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    min-width: 140px;
    text-align: left;
}

.multiselect-btn:focus {
    outline: none;
    border-color: #0066cc;
}

.multiselect-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 2000;
    min-width: 200px;
    max-height: 260px;
    overflow-y: auto;
}

.multiselect-dropdown.open {
    display: block;
}

.multiselect-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.multiselect-item:hover {
    background: #f0f5ff;
}

.multiselect-item input[type="checkbox"] {
    cursor: pointer;
    flex-shrink: 0;
}

.multiselect-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 4px 0;
}

/* Responsive Design */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .controls {
        display: none;
    }

    .container {
        box-shadow: none;
    }
}

@media (max-width: 768px) {
    .header-logos {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .pdf-header h1 {
        font-size: 16px;
    }

    .info-row, .taxpayer-info {
        flex-direction: column;
        gap: 10px;
    }

    .input-fields {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
    }

    .e3-table {
        font-size: 11px;
    }

    .e3-table th, .e3-table td {
        padding: 6px;
    }

    .col-description {
        width: auto;
    }
}
