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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Navigation Tabs */
.main-nav {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
    padding: 0;
    margin: 0;
    position: relative;
}

.nav-tab {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #555;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
}

.nav-tab:hover {
    background: linear-gradient(to bottom, #f0f2f5, #e9ecef);
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.nav-tab:active {
    transform: translateY(0);
}

.nav-tab.active {
    background: #fff;
    color: #667eea;
    border-bottom-color: #667eea;
}

.nav-tab.disabled {
    background: #e9ecef;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.nav-tab.disabled:hover {
    background: #e9ecef;
    color: #999;
    transform: none;
    box-shadow: none;
}

.nav-tab.disabled.active {
    background: #f8f9fa;
    color: #999;
    border-bottom-color: #ccc;
}

.nav-tab.enabled {
    cursor: pointer;
}

/* Dropdown Navigation */
.nav-dropdown {
    position: relative;
    flex: 1;
}

.dropdown-toggle {
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-toggle:hover {
    background: linear-gradient(to bottom, #f0f2f5, #e9ecef);
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.nav-dropdown.active .dropdown-toggle {
    background: #fff;
    color: #667eea;
    border-bottom-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.dropdown-arrow {
    font-size: 0.8em;
    transition: transform 0.3s ease, color 0.3s ease;
    margin-left: 5px;
    color: #999;
}

.dropdown-toggle:hover .dropdown-arrow {
    color: #667eea;
}

.nav-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
    color: #667eea;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 200px;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    transition: all 0.25s ease;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95em;
    position: relative;
    border-left: 3px solid transparent;
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

.dropdown-menu a:hover {
    background: linear-gradient(to right, #f0f4ff, #e7f0ff);
    color: #667eea;
    border-left-color: #667eea;
    padding-left: 25px;
    transform: translateX(3px);
    box-shadow: inset 0 0 10px rgba(102, 126, 234, 0.1);
}

.dropdown-menu a:active {
    transform: translateX(0);
    background: linear-gradient(to right, #e0e8ff, #d4e0ff);
}

.dropdown-menu a.active {
    background: linear-gradient(to right, #e7f0ff, #d4e0ff);
    color: #667eea;
    font-weight: 600;
    border-left-color: #667eea;
    box-shadow: inset 0 0 10px rgba(102, 126, 234, 0.15);
}

.dropdown-menu a.disabled {
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
    background: #f8f9fa;
}

.dropdown-menu a.disabled:hover {
    background: #f8f9fa;
    color: #999;
}

.tab-content {
    min-height: 400px;
}

.form-section {
    padding: 30px;
    border-bottom: 1px solid #e0e0e0;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.form-section h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.2em;
}

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

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

.form-grid.two-columns {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.9em;
}

.form-group input,
.form-group textarea {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
    font-family: inherit;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Party Columns */
.party-column {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

/* Items Section */
.item-row {
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
    background: #f8f9fa;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.item-header span {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

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

.charges-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

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

.btn-add-item,
.btn-remove-item {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-add-item {
    background: #667eea;
    color: #fff;
    margin-top: 10px;
}

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

.btn-remove-item {
    background: #e74c3c;
    color: #fff;
}

.btn-remove-item:hover {
    background: #c0392b;
}

/* Form Actions */
.form-actions {
    padding: 30px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    background: #f8f9fa;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: #fff;
}

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

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

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: #fff;
}

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

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

/* Message Display */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    animation: slideIn 0.3s ease-out;
}

.message.success {
    background: #28a745;
    color: #fff;
}

.message.error {
    background: #dc3545;
    color: #fff;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-grid.two-columns {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    header h1 {
        font-size: 2em;
    }
}

/* Required field indicator */
.form-group label:has(+ input[required])::after,
.form-group label:has(+ textarea[required])::after {
    content: " *";
    color: #e74c3c;
}

/* Invoices Table */
.invoices-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.invoices-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.invoices-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8em;
}

.invoices-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.8em;
}

.invoices-table tbody tr {
    transition: background-color 0.2s;
}

.invoices-table tbody tr:hover {
    background-color: #f5f5f5;
    cursor: pointer;
}

.invoices-table tbody tr:last-child td {
    border-bottom: none;
}

.invoice-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-edit-invoice,
.btn-preview-invoice,
.btn-delete-invoice {
    padding: 4px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-edit-invoice {
    background-color: #007bff;
    color: white;
}

.btn-edit-invoice:hover {
    background-color: #0056b3;
}

.btn-preview-invoice {
    background-color: #28a745;
    color: white;
}

.btn-preview-invoice:hover {
    background-color: #1e7e34;
}

.btn-delete-invoice {
    background-color: #dc3545;
    color: white;
}

.btn-delete-invoice:hover {
    background-color: #c82333;
}

.bulk-actions {
    margin-top: 20px;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn.btn-danger {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-danger:hover:not(:disabled),
.btn.btn-danger:hover:not(:disabled) {
    background-color: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.btn-danger:disabled,
.btn.btn-danger:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* GSTIN Validation Messages */
.gstin-validation-message {
    font-size: 0.85em;
    margin-top: 5px;
    padding: 5px 8px;
    border-radius: 4px;
    font-weight: 500;
    display: block;
}

.gstin-validation-success {
    color: #28a745;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.gstin-validation-error {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.gstin-validation-warning {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
}

