@import "https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&display=swap";

:root {
    --primary-color: #0f766e;
    --primary-hover: #0b5f58;
    --secondary-color: #f59e0b;
    --secondary-deep: #d97706;
    --bg-dark: #17262a;
    --bg-darker: #101d20;
    --bg-soft: #21363c;
    --text-light: #e9f3f4;
    --text-muted: #96adb3;
    --border-color: rgba(255, 255, 255, 0.14);
    --card-bg: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.25);
    --font-sans: "Sora", system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background:
        radial-gradient(1200px 560px at 8% 6%, rgba(15, 118, 110, 0.38), transparent 60%),
        radial-gradient(1000px 580px at 95% 12%, rgba(245, 158, 11, 0.27), transparent 62%),
        linear-gradient(135deg, #0d1518 0%, #12252a 48%, #111e22 100%);
    color: #1c2e33;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    animation: app-enter 0.45s ease-out;
}

@keyframes app-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: rgba(16, 29, 32, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
    margin: 0 0.5rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color), #0b5f58);
    color: #f4f8f9;
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.35);
}

.action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn.primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
}

.action-btn.secondary {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-deep));
    color: #20140a;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.editor-panel {
    width: 320px;
    min-width: 320px;
    padding: 1.5rem;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(23, 38, 42, 0.97), rgba(19, 32, 35, 0.97));
    color: var(--text-light);
    border-right: 1px solid var(--border-color);
}

.editor-panel::-webkit-scrollbar {
    width: 6px;
}

.editor-panel::-webkit-scrollbar-track {
    background: transparent;
}

.editor-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 3px;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.sidebar-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.editor-section {
    background: linear-gradient(180deg, rgba(33, 54, 60, 0.92), rgba(27, 45, 50, 0.92));
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.editor-section h2 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group {
    margin-bottom: 0.75rem;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 7px;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
    transition: all 0.2s ease;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.input-group input::placeholder {
    color: rgba(233, 243, 244, 0.36);
}

.preview-panel {
    flex: 1;
    padding: 2rem;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background:
        radial-gradient(900px 420px at 20% 8%, rgba(15, 118, 110, 0.3), transparent 60%),
        radial-gradient(850px 500px at 88% 14%, rgba(245, 158, 11, 0.22), transparent 62%),
        linear-gradient(135deg, #0e171a 0%, #163036 50%, #112127 100%);
    position: relative;
    cursor: grab;
}

.preview-panel:active {
    cursor: grabbing;
}

.payslip-container {
    width: 210mm;
    min-height: 297mm;
    background: #fff;
    padding: 40px 50px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
    position: relative;
    font-family: Arial, sans-serif;
    color: #333;
    border-radius: 10px;
    transition: transform 0.1s ease-out;
}

.dynamic-table h3 {
    font-size: 0.875rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 32px;
    gap: 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 32px;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.table-row input {
    width: 100%;
    padding: 0.375rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
}

.btn-remove {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.35);
}

.btn-add {
    display: block;
    width: 100%;
    padding: 0.5rem;
    background: rgba(15, 118, 110, 0.22);
    color: #5fe0d2;
    border: 1px dashed rgba(95, 224, 210, 0.9);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    transition: all 0.2s ease;
}

.btn-add:hover {
    background: rgba(15, 118, 110, 0.35);
}

.payslip-header-centered {
    text-align: center;
    margin-bottom: 20px;
}

.payslip-header-centered h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0f4c81;
    margin: 0 0 5px;
}

.company-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f4c81;
    margin: 0 0 10px;
}

.company-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.company-contact,
.company-address,
.company-website {
    font-size: 0.8rem;
    color: #555;
    line-height: 1.4;
}

.company-website a {
    color: #0b5f58;
    text-decoration: underline;
}

.divider-blue {
    border: 0;
    border-top: 2px solid #0f4c81;
    margin: 15px 0 25px;
}

.info-grid-compact {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    font-size: 0.85rem;
}

.info-column {
    width: 48%;
}

.info-row {
    display: flex;
    margin-bottom: 4px;
}

.info-row .label {
    font-weight: 700;
    width: 140px;
    flex-shrink: 0;
    color: #333;
}

.info-row .value {
    color: #555;
}

.table-section {
    margin-bottom: 25px;
}

.section-title {
    background-color: #d1d5db;
    padding: 5px 10px;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #000;
}

.payslip-table-modern {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.payslip-table-modern th {
    background-color: #e5e7eb;
    padding: 5px 10px;
    text-align: left;
    font-weight: 700;
    border: 1px solid #ccc;
    border-top: none;
}

.payslip-table-modern td {
    padding: 5px 10px;
    border: 1px solid #ccc;
}

.col-desc {
    width: 50%;
}

.col-center {
    text-align: center;
}

.col-right {
    text-align: right;
}

.payslip-table-modern tfoot td {
    border-top: 2px solid #999;
    background-color: #fff;
}

.payslip-footer-section {
    margin-top: 30px;
    background-color: #e5e7eb;
    padding: 15px;
    font-size: 0.85rem;
}

.net-pay-row {
    display: flex;
    justify-content: space-between;
}

.net-pay-label {
    width: 100%;
}

.bank-details {
    margin-top: 10px;
    margin-left: 140px;
}

.bank-row {
    display: flex;
    margin-bottom: 3px;
}

.bank-label {
    width: 120px;
    font-weight: 700;
}

.net-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.zoom-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 29, 32, 0.92);
    padding: 8px 12px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    -webkit-user-select: none;
    user-select: none;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--primary-color);
    color: #fff;
    border-radius: 7px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.zoom-btn:hover {
    background: var(--primary-hover);
}

.zoom-level {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: var(--text-light);
}

.app-footer {
    display: none;
}

@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }

    .editor-panel {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 50vh;
    }

    .preview-panel {
        min-height: 50vh;
    }

    .nav-center {
        position: static;
        transform: none;
    }

    .nav-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .nav-bar {
        padding: 0.5rem;
    }

    .tab-btn,
    .action-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    .editor-panel {
        padding: 1rem;
    }
}

@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        background: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .nav-bar,
    .editor-panel,
    .zoom-controls,
    .app-footer {
        display: none !important;
    }

    .main-content {
        display: block;
        height: auto;
        overflow: visible;
    }

    .preview-panel {
        padding: 0;
        background: #fff;
        overflow: visible;
        display: block;
        cursor: default !important;
    }

    .payslip-container {
        box-shadow: none;
        width: 100%;
        min-height: 100vh;
        padding: 40px 50px;
        margin: 0;
        border: none;
        transform: none !important;
        border-radius: 0;
    }
}

.preview-panel::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

.preview-panel {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.logo-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-preview {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--border-color);
}

.logo-upload-btn {
    padding: 0.5rem 1rem;
    background: rgba(245, 158, 11, 0.2);
    color: #ffd98a;
    border: 1px solid rgba(245, 158, 11, 0.55);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logo-upload-btn:hover {
    background: rgba(245, 158, 11, 0.35);
}
