* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #f59e0b;
    --primary-dark: #d97706;
    --primary-darker: #b45309;
    --accent-red: #dc2626;
    --accent-orange: #ea580c;
    --accent-light: #fef3c7;
    --accent-lighter: #fffbeb;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --dark: #1f2937;
    --dark-light: #374151;
    --gray: #6b7280;
    --gray-light: #9ca3af;
    --border: #fde68a;
    --border-light: #fed7aa;
    --background: #fef7ee;
    --white: #ffffff;
    --shadow: 0 2px 4px rgba(220, 38, 38, 0.08);
    --shadow-md: 0 4px 12px rgba(220, 38, 38, 0.12);
    --shadow-lg: 0 10px 25px rgba(220, 38, 38, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 50%, #fed7aa 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 20%, #dc2626 40%, #ea580c 60%, #f59e0b 80%, #fbbf24 100%);
    color: var(--white);
    padding: 2.5rem 0;
    margin-bottom: 2.5rem;
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.3);
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.1) 75%, rgba(255,255,255,0.1)),
                linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.1) 75%, rgba(255,255,255,0.1));
    background-size: 60px 60px;
    background-position: 0 0, 30px 30px;
    opacity: 0.3;
    z-index: 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.app-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

.header-text {
    text-align: left;
}

.app-title {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
    letter-spacing: -0.5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.app-subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.98;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15);
}

/* Main Content */
.main-content {
    margin-bottom: 3rem;
}

/* Sections */
.section {
    background: var(--white);
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 20px rgba(220, 38, 38, 0.1);
    border: 2px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-red), var(--accent-orange), var(--primary-color));
}

.section:hover {
    box-shadow: 0 12px 32px rgba(220, 38, 38, 0.15);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.section-header {
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--accent-light);
    padding-bottom: 1.25rem;
}

.section-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-red), var(--primary-color));
    color: var(--white);
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    position: relative;
}

.section-number::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    opacity: 0.3;
}

.section-description {
    color: var(--gray);
    font-size: 0.95rem;
    margin-left: 3rem;
}

.section-content {
    padding-top: 1rem;
}

/* Forms */
.form-label {
    display: block;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
}

.form-select,
.form-input,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--dark);
    background-color: var(--white);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.05);
}

.form-select:hover,
.form-input:hover,
.form-textarea:hover {
    border-color: var(--primary-color);
}

.form-select:focus,
.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.1), 0 4px 8px rgba(245, 158, 11, 0.15);
    background-color: var(--accent-lighter);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group {
    margin-bottom: 1.25rem;
}

/* Form Layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--accent-light);
}

/* Add Equipment Section */
.add-equipment-form {
    background: var(--accent-lighter);
    padding: 2rem;
    border-radius: 12px;
    border: 2px solid var(--border);
}

/* Currency Section */
.currency-section {
    padding: 1.25rem 2rem;
    margin-bottom: 1.5rem;
}

.currency-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.currency-selector .form-label {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--dark);
}

.currency-input {
    width: 120px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
}

.currency-hint {
    font-size: 0.85rem;
    color: var(--gray);
    font-style: italic;
}

/* Template Section */
.template-selection {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.template-selection .form-label {
    margin-bottom: 0;
    white-space: nowrap;
}

.template-selection .form-select {
    flex: 1;
    min-width: 250px;
}

.template-info {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--background);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.template-info-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.template-description {
    color: var(--gray);
    margin-bottom: 1rem;
}

.template-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Category Selection */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.category-checkbox {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-checkbox:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.category-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.category-checkbox label {
    font-weight: 500;
    cursor: pointer;
    flex: 1;
}

/* Equipment Dropdowns */
.equipment-dropdowns {
    margin-top: 2rem;
}

.equipment-dropdown-group {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--background);
    border-radius: 8px;
}

.equipment-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.equipment-dropdown-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--dark);
}

.equipment-dropdown-controls {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.75rem;
    align-items: end;
}

.quantity-group {
    display: flex;
    flex-direction: column;
}

.quantity-group .form-label {
    font-size: 0.85rem;
}

.quantity-group .form-input {
    width: 80px;
}

/* Selected Equipment */
.selected-equipment {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 8px;
}

.subsection-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 1rem;
}

.equipment-list {
    margin-bottom: 1rem;
}

.empty-state {
    color: var(--gray-light);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.equipment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.equipment-item:hover {
    box-shadow: var(--shadow);
}

.equipment-item-info {
    flex: 1;
}

.equipment-item-name {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.equipment-item-details {
    font-size: 0.85rem;
    color: var(--gray);
}

.equipment-item-price {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.equipment-item-value {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.05rem;
}

.equipment-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--white);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 1.15rem;
    font-weight: 600;
}

.total-label {
    color: var(--dark);
}

.total-value {
    color: var(--primary-color);
    font-size: 1.3rem;
}

/* Labor Section */
.labor-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.labor-summary {
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.05rem;
}

.summary-label {
    font-weight: 500;
    color: var(--dark);
}

.summary-value {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.15rem;
}

/* Price Breakdown */
.price-breakdown {
    background: var(--background);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-label {
    font-weight: 500;
    color: var(--dark);
}

.breakdown-value {
    font-weight: 600;
    color: var(--dark);
    font-size: 1.05rem;
}

.subtotal-item {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border);
}

.total-item {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--primary-color);
}

.total-item .breakdown-label,
.total-item .breakdown-value {
    font-size: 1.25rem;
    color: var(--primary-color);
}

/* Package Actions */
.package-actions {
    padding: 1.5rem;
    background: var(--background);
    border-radius: 8px;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-red), var(--primary-color));
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-darker), var(--accent-red));
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--dark);
    color: var(--white);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--dark-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--primary-color);
    color: var(--white);
}

.btn-success:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    color: var(--dark);
    border: 2px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--dark);
    background: var(--dark);
    color: var(--white);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 2.5rem 0;
    color: var(--gray);
    font-size: 0.9rem;
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.5), rgba(254, 215, 170, 0.5));
    border-top: 2px solid var(--border);
    margin-top: 3rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, var(--accent-red), var(--primary-color));
    color: var(--white);
    padding: 1.25rem 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.3);
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 400px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--secondary-color);
}

.toast.error {
    background: var(--danger-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-title {
        font-size: 2rem;
    }

    .app-subtitle {
        font-size: 1rem;
    }

    .currency-section {
        padding: 1rem 1.5rem;
    }

    .currency-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .currency-input {
        width: 100%;
    }

    .section {
        padding: 1.5rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .section-description {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .template-selection {
        flex-direction: column;
        align-items: stretch;
    }
    
    .template-selection .form-label {
        margin-bottom: 0.5rem;
    }
    
    .template-selection .form-select {
        min-width: 100%;
    }
    
    .template-selection .btn {
        width: 100%;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .equipment-dropdown-controls {
        grid-template-columns: 1fr;
    }

    .labor-inputs {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }

    .toast {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}
