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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8fafc;
    color: #2d3748;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: #1a202c;
    font-size: 28px;
    margin-bottom: 8px;
}

.header p {
    color: #718096;
    font-size: 16px;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 600px;
}
.input-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.preview-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.tab-navigation {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #e2e8f0;
    margin: 0;
    background: #f7fafc;
    border-radius: 12px 12px 0 0;
    gap: 2px;
    padding: 4px 4px 0 4px;
}

.tab-button {
    flex: 0 1 auto;
    padding: 8px 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #718096;
    transition: all 0.2s;
    border-radius: 6px 6px 0 0;
    font-size: 12px;
    white-space: nowrap;
}

.tab-button.active {
    background: white;
    color: #2d3748;
    border-bottom: 2px solid #4f46e5;
}

.tab-button:hover:not(.active) {
    background: #edf2f7;
    color: #4a5568;
}

.tab-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

input[type="number"],
input[type="text"],
input[type="date"],
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f7fafc;
    border-radius: 0 0 12px 12px;
    gap: 8px;
}

.nav-button {
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}
.nav-button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9fafb;
}

.nav-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9fafb;
}

.preview-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.preview-content h2 {
    color: #1a202c;
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

/* ============================================
   DEADLINE RESULT STYLES
============================================ */

.deadline-result {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #22c55e;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
}

.deadline-result.warning {
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border-color: #eab308;
}

.deadline-result.danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #ef4444;
}

.deadline-result h3 {
    font-size: 14px;
    color: #166534;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.deadline-result.warning h3 {
    color: #a16207;
}

.deadline-result.danger h3 {
    color: #dc2626;
}

.deadline-date {
    font-size: 32px;
    font-weight: 700;
    color: #166534;
    margin-bottom: 4px;
}

.deadline-result.warning .deadline-date {
    color: #a16207;
}

.deadline-result.danger .deadline-date {
    color: #dc2626;
}

.deadline-days {
    font-size: 16px;
    color: #15803d;
}

.deadline-result.warning .deadline-days {
    color: #ca8a04;
}

.deadline-result.danger .deadline-days {
    color: #dc2626;
}

/* ============================================
   CALENDAR STYLES
============================================ */

.calendar-container {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.calendar-header h4 {
    font-size: 16px;
    color: #1e293b;
}

.calendar-nav {
    display: flex;
    gap: 8px;
}

.calendar-nav button {
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.calendar-nav button:hover {
    background: #e2e8f0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day-header {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    padding: 8px 0;
}

.calendar-day {
    text-align: center;
    padding: 8px 4px;
    font-size: 13px;
    border-radius: 6px;
    cursor: default;
    position: relative;
}

.calendar-day.other-month {
    color: #cbd5e1;
}

.calendar-day.today {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

.calendar-day.trigger {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
}

.calendar-day.deadline {
    background: #dcfce7;
    color: #166534;
    font-weight: 700;
    border: 2px solid #22c55e;
}

.calendar-day.weekend {
    color: #94a3b8;
}

.calendar-day.holiday {
    background: #fee2e2;
    color: #dc2626;
}

.calendar-day.counting {
    background: #f1f5f9;
}

/* ============================================
   TIMELINE STYLES
============================================ */

.timeline-container {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.timeline-container h4 {
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 12px;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.timeline-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.timeline-marker.trigger {
    background: #fef3c7;
    color: #92400e;
}

.timeline-marker.service {
    background: #dbeafe;
    color: #1e40af;
}

.timeline-marker.deadline {
    background: #dcfce7;
    color: #166534;
}

.timeline-content {
    flex: 1;
}

.timeline-content .date {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.timeline-content .desc {
    font-size: 13px;
    color: #64748b;
}

/* ============================================
   HOLIDAYS LIST STYLES
============================================ */

.holidays-list {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.holidays-list h4 {
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 12px;
}

.holiday-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
}

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

.holiday-item .name {
    color: #374151;
}

.holiday-item .date {
    color: #64748b;
    font-family: 'SF Mono', 'Monaco', monospace;
}

/* ============================================
   RULES REFERENCE STYLES
============================================ */

.rules-reference {
    background: #eff6ff;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.rules-reference h4 {
    font-size: 14px;
    color: #1e40af;
    margin-bottom: 8px;
}

.rules-reference p {
    font-size: 13px;
    color: #1e40af;
    margin-bottom: 8px;
}

.rules-reference p:last-child {
    margin-bottom: 0;
}

.rules-reference code {
    background: rgba(30, 64, 175, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', monospace;
    font-size: 12px;
}

/* ============================================
   SUMMARY BOX STYLES
============================================ */

.summary-box {
    background: #f0f9ff;
    border: 1px solid #0284c7;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.summary-box h3 {
    color: #0369a1;
    margin-bottom: 8px;
    font-size: 16px;
}

.summary-box p {
    margin-bottom: 4px;
    font-size: 14px;
}

.warning-box {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.warning-box h3 {
    color: #92400e;
    margin-bottom: 8px;
    font-size: 16px;
}

.info-box {
    background: #eff6ff;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
    font-size: 13px;
    color: #1e40af;
}

/* ============================================
   HELP TIP STYLES
============================================ */

.help-tip-wrapper {
    position: relative;
    display: inline-flex;
    margin-left: 6px;
}

.help-tip-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    border: none;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.help-tip-btn:hover {
    background: #2563eb;
}

.help-tip-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    width: 280px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    margin-bottom: 8px;
}

.help-tip-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
}

/* Tab description text */
.tab-description {
    color: #64748b;
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.tab-panel h3 {
    color: #1e293b;
    font-size: 18px;
    margin-bottom: 8px;
}

/* ============================================
   CALCULATION BREAKDOWN STYLES
============================================ */

.calc-breakdown {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.calc-breakdown h4 {
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 12px;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
}

.calc-row:last-child {
    border-bottom: none;
}

.calc-row.total {
    font-weight: 600;
    background: #f0fdf4;
    margin: 8px -16px -16px;
    padding: 12px 16px;
    border-radius: 0 0 8px 8px;
}

.calc-row .label {
    color: #475569;
}

.calc-row .value {
    color: #1e293b;
    font-family: 'SF Mono', 'Monaco', monospace;
}

.calc-row.add .value {
    color: #16a34a;
}

.calc-row.add .value::before {
    content: '+';
}

/* ============================================
   DOCUMENT TYPE CARDS
============================================ */

.doc-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.doc-type-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.doc-type-card:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

.doc-type-card.selected {
    border-color: #4f46e5;
    background: #eef2ff;
}

.doc-type-card h5 {
    font-size: 13px;
    color: #1e293b;
    margin-bottom: 4px;
}

.doc-type-card p {
    font-size: 11px;
    color: #64748b;
}

/* ============================================
   CONTEXTUAL HELP
============================================ */

.contextual-help {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #3b82f6;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.contextual-help h3 {
    color: #1e40af;
    font-size: 16px;
    margin-bottom: 8px;
}

.contextual-help .help-intro {
    color: #1e40af;
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.5;
}

.contextual-help .help-tips {
    margin: 0;
    padding-left: 20px;
}

.contextual-help .help-tips li {
    color: #1e40af;
    font-size: 13px;
    margin-bottom: 6px;
    line-height: 1.4;
}

/* ============================================
   STATE DROPDOWN
============================================ */

.state-select-wrapper {
    position: relative;
}

.state-select-wrapper select {
    appearance: none;
    padding-right: 32px;
}

.state-select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #64748b;
    pointer-events: none;
}

/* ============================================
   CTA BOX
============================================ */

.cta-box {
    margin-top: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #22c55e;
    border-radius: 12px;
    text-align: center;
}

.cta-box h4 {
    color: #166534;
    font-size: 18px;
    margin-bottom: 8px;
}

.cta-box p {
    color: #15803d;
    font-size: 14px;
    margin-bottom: 16px;
}

.cta-button {
    background: #16a34a;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.cta-button:hover {
    background: #15803d;
}

/* ============================================
   RESPONSIVE
============================================ */

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
    }

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

    .doc-type-grid {
        grid-template-columns: 1fr;
    }

    .navigation-buttons {
        flex-wrap: wrap;
        gap: 8px;
    }

    .nav-button {
        font-size: 12px;
        padding: 8px 12px;
    }

    .help-tip-popup {
        width: 220px;
        left: auto;
        right: 0;
        transform: none;
    }

    .help-tip-popup::after {
        left: auto;
        right: 10px;
        transform: none;
    }

    .calendar-day {
        padding: 6px 2px;
        font-size: 11px;
    }

    .calendar-day-header {
        font-size: 10px;
    }

    .deadline-date {
        font-size: 24px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .tab-button {
        font-size: 10px;
        padding: 5px 6px;
    }

    .deadline-date {
        font-size: 20px;
    }

    .calendar-container {
        padding: 12px;
    }

    .calc-row {
        font-size: 12px;
    }

    .timeline-item {
        gap: 8px;
    }

    .timeline-marker {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}

/* ============================================
   MOBILE TOUCH FIXES
============================================ */

button,
.nav-button,
.tab-button,
.cta-button {
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

button {
    touch-action: manipulation;
}

.calculator-container,
#root {
    position: relative;
    z-index: 10;
}
