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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Header & Navigation */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo h2 {
    font-size: 28px;
    font-weight: 700;
}

.logo span {
    color: #ffd700;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.hamburger span {
    width: 28px;
    height: 3px;
    background: white;
    margin: 4px 0;
    transition: all 0.3s ease;
    border-radius: 3px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(9px, 9px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255,255,255,0.2);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 300px);
    padding: 40px 20px;
}

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

.page-title {
    text-align: center;
    margin-bottom: 40px;
    color: #333;
    font-size: 36px;
}

.intro-text {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

/* Invoice Layout */
.invoice-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.invoice-preview {
    flex: 1;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.invoice-content {
    border: 2px solid #e0e0e0;
    padding: 40px;
    background: white;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #667eea;
}

.company-logo {
    flex: 1;
}

.company-logo {
    flex: 1;
}

/* Logo Box Container */
.logo-box {
    position: relative;
    width: 200px;
    height: 120px;
}

#logoFileInput {
    display: none;
}

/* Upload Area Style */
.logo-upload-area {
    width: 100%;
    height: 100%;
    border: 2px dashed #667eea;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.logo-upload-area:hover {
    background-color: #e8ebf7;
    border-color: #5568d3;
    transform: translateY(-2px);
}

.logo-upload-icon {
    font-size: 32px;
    margin-bottom: 5px;
    display: block;
}

.logo-upload-area p {
    margin: 5px 0 0 0;
    font-weight: 600;
    color: #667eea;
    font-size: 13px;
}

.logo-upload-area small {
    display: block;
    color: #999;
    font-size: 11px;
    margin-top: 2px;
}

/* Image Area Style */
.logo-image-area {
    width: 100%;
    height: 100%;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
    padding: 10px;
}

#logoImg {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Delete Button */
.delete-logo-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 20px;
    height: 20px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.delete-logo-btn:hover {
    background-color: #c82333;
    transform: scale(1.1);
}

.invoice-title {
    font-size: 48px;
    font-weight: 700;
    color: #667eea;
    text-align: right;
}

.invoice-info-section {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.section-label {
    font-weight: 700;
    color: #667eea;
    margin-bottom: 10px;
    font-size: 14px;
    letter-spacing: 1px;
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border 0.3s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.detail-row label {
    font-weight: 600;
    margin-right: 10px;
}

.detail-row input {
    flex: 1;
    margin-bottom: 0;
}

/* Items Table */
.items-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    display: table;
}

.items-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #667eea;
    font-size: 14px;
}

.items-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.items-table input {
    margin-bottom: 0;
    padding: 8px;
}

.item-amount {
    text-align: right;
    font-weight: 600;
}

/* Mobile: Convert table to cards */
@media (max-width: 768px) {
    .items-table {
        display: block;
        overflow-x: visible;
    }
    
    .items-table thead {
        display: none;
    }
    
    .items-table tbody {
        display: block;
    }
    
    .items-table tr.item-row {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 15px;
        background: #f8f9fa;
        position: relative;
    }
    
    .items-table td {
        display: block;
        text-align: left;
        padding: 8px 0;
        border: none;
    }
    
    .items-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #667eea;
        display: block;
        margin-bottom: 5px;
        font-size: 12px;
        text-transform: uppercase;
    }
    
    .items-table td input {
        width: 100%;
    }
    
    .items-table .item-amount {
        text-align: left;
        font-size: 16px;
        font-weight: 700;
        color: #667eea;
    }
    
    .items-table .remove-btn {
        position: absolute;
        top: 10px;
        right: 10px;
        margin: 0;
    }
}

.add-item-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.add-item-btn:hover {
    background: #218838;
}

.remove-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s;
}

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

/* Totals Section */
.totals-section {
    margin-left: auto;
    width: 350px;
    margin-top: 20px;
}

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

.total-row.grand-total {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    border-top: 3px solid #667eea;
    padding-top: 15px;
    margin-top: 10px;
}

.notes-section {
    margin-top: 30px;
}

.notes-section textarea {
    min-height: 100px;
    resize: vertical;
}

.download-btn {
    width: 100%;
    background: #667eea;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    margin-top: 30px;
    transition: all 0.3s;
}

.download-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Spinner Styles */
.spinner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3000;
}

.spinner.show {
    display: block;
}

.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2999;
    display: none;
}

.spinner-overlay.show {
    display: block;
}

.spinner-content {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.spinner-ring {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Options Panel */
.options-panel {
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.option-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.option-card h3 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 20px;
}

.option-card label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.apply-btn {
    width: 100%;
    background: #667eea;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s;
}

.apply-btn:hover {
    background: #5568d3;
}

/* Advertisement Box */
.ad-box {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.ad-box h3 {
    margin: 0 0 15px 0;
    color: #667eea;
    font-size: 20px;
}

.ad-content {
    text-align: center;
}

.ad-content p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #555;
}

.ad-content p strong {
    color: #667eea;
    font-weight: 700;
}

.ad-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s;
    font-size: 14px;
}

.ad-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

/* Advertisement Box */
.ad-box {
    background: white !important;
    border: none !important;
}

.ad-box h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.ad-content {
    text-align: center;
}

.ad-content p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #555;
}

.ad-content p strong {
    color: #667eea;
    font-weight: 700;
}

.ad-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s;
    font-size: 14px;
}

.ad-btn:hover {
    background: #5568d3;
}

/* Page Container */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
}

.content-wrapper {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.content-wrapper h1 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 36px;
}

.content-wrapper h2 {
    color: #333;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 24px;
}

.about-content {
    line-height: 1.8;
}

.about-content p {
    margin-bottom: 15px;
}

.about-content ul {
    list-style: none;
    padding-left: 0;
    margin: 20px 0;
}

.about-content li {
    padding: 10px 0;
    padding-left: 30px;
    position: relative;
}

.about-content li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
    font-size: 20px;
}

/* Testimonials */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

.testimonial-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.3s;
}

.testimonial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.rating {
    margin-bottom: 15px;
    font-size: 20px;
}

.testimonial-message {
    font-style: italic;
    margin-bottom: 15px;
    line-height: 1.6;
    color: #555;
}

.testimonial-author {
    text-align: right;
    color: #666;
    margin-bottom: 10px;
}

.testimonial-author strong {
    color: #333;
    font-size: 16px;
}

.testimonial-date {
    text-align: right;
    color: #999;
    font-size: 12px;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: auto;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.close-btn {
    color: white;
    font-size: 28px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
}

.close-btn:hover {
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.cancel-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

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

.open-modal-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.3s;
}

.open-modal-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

@media (max-width: 768px) {
    .modal-content {
        margin: 0% auto;
        width: 95%;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-buttons {
        flex-direction: column-reverse;
    }
    
    .modal-buttons button {
        width: 100%;
    }
}

/* Contact Form */
.contact-form {
    margin-bottom: 40px;
}

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

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

.submit-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
}

.submit-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.contact-info {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    margin-top: 30px;
}

.contact-info h2 {
    color: #667eea;
    margin-top: 0;
    margin-bottom: 25px;
}

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

.info-item {
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.info-item h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 18px;
}

.info-item p {
    color: #666;
    margin: 0;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    padding: 40px 20px 20px;
    margin-top: 60px;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 15px;
    color: #ffd700;
}

.footer-section p {
    margin-bottom: 10px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section a {
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: #ffd700;
}

.social-links {
    display: flex;
    gap: 15px;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #34495e;
    color: #bdc3c7;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .invoice-layout {
        flex-direction: column;
    }
    
    .options-panel {
        width: 100%;
    }
}

@media (max-width: 768px) {
    /* Show hamburger menu */
    .hamburger {
        display: flex;
    }
    
    /* Hide desktop menu, show as mobile menu */
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding-top: 50px;
        gap: 20px;
        transition: left 0.4s ease;
        z-index: 999;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-menu a {
        font-size: 20px;
        padding: 15px 30px;
        width: 80%;
        text-align: center;
    }

    .invoice-info-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .invoice-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .invoice-title {
        font-size: 32px;
        text-align: left;
        margin-top: 15px;
    }
    
    .testimonials-grid {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 40px 20px;
    }

    .invoice-preview {
        padding: 10px;
    }
    
    .invoice-content {
        padding: 10px;
    }
    
    .totals-section {
        width: 100%;
        margin-left: 0;
    }
    
    .page-title {
        font-size: 28px;
    }
    
    .content-wrapper {
        padding: 20px;
    }
    
    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .invoice-layout {
        flex-direction: column;
    }
    
    .options-panel {
        width: 100%;
    }
}