/* Modern CSS Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1000px;
    margin: auto;
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Header Styles */
h1 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    color: #34495e;
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 600;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.admin-link {
    position: absolute;
    top: 0;
    right: 0;
    margin-top: 10px;
}

/* Navigation Links */
.nav-links {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-links a {
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.nav-links a:not(.btn-warning):not(.btn-danger) {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.nav-links a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-admin {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* Item Row Styles */
.item-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    margin-bottom: 15px;
    align-items: flex-end;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    transition: all 0.3s ease;
}

.item-row:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
}

.item-row .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

/* Button Styles */
#add-item-btn, .remove-item-btn, .submit-btn, .btn-small {
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.remove-item-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    height: fit-content;
    align-self: center;
    padding: 10px 20px;
}

#add-item-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    margin: 20px 0;
    display: block;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.submit-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    display: block;
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
    margin-top: 30px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

/* Button Hover Effects */
.submit-btn:hover, #add-item-btn:hover, .remove-item-btn:hover, .btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Download Buttons Styling */
.download-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-excel {
    background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
    color: white !important;
    border: none;
}

.btn-excel:hover {
    background: linear-gradient(135deg, #27ae60, #229954) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.3);
}

.btn-pdf {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    color: white !important;
    border: none;
}

.btn-pdf:hover {
    background: linear-gradient(135deg, #c0392b, #a93226) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

.btn-view {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
    color: white !important;
    border: none;
}

.btn-view:hover {
    background: linear-gradient(135deg, #2980b9, #1f618d) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

table th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 18px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.95rem;
}

table tr:nth-child(even) {
    background: #f8f9fa;
}

table tr:hover {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

/* Flash Messages */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 12px;
    font-weight: 600;
    border-left: 5px solid;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-left-color: #28a745;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left-color: #dc3545;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeeba);
    color: #856404;
    border-left-color: #ffc107;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border-left-color: #17a2b8;
}

/* Admin Panel Styles */
.admin-panel {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.admin-panel h3 {
    color: #8e44ad;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
}

.admin-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.admin-actions a {
    text-decoration: none;
    padding: 15px 20px;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.admin-actions a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer and Logout Styles */
.footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.logout-link {
    color: #7f8c8d;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.logout-link:hover {
    color: #e74c3c;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .nav-links {
        justify-content: center;
    }
    
    .item-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .item-row .form-group {
        width: 100%;
        min-width: unset;
    }
    
    .remove-item-btn {
        width: 100%;
        margin-top: 15px;
    }
    
    .admin-actions {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    table th, table td {
        padding: 12px 8px;
    }
    
    /* Responsive adjustments for download buttons */
    .download-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .btn-excel, .btn-pdf {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .nav-links a {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* Invoice View Styles */
.invoice-view {
    background: white;
    border-radius: 15px;
    padding: 40px;
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.invoice-header {
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 20px;
}

.invoice-header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.company-details h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.company-details p {
    margin: 5px 0;
    color: #34495e;
}

.contact-info {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.invoice-details {
    margin: 30px 0;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.invoice-info {
    flex: 1;
    min-width: 300px;
}

.invoice-info h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.details-table {
    width: 100%;
    border-collapse: collapse;
}

.details-table td {
    padding: 10px;
    border-bottom: 1px solid #ecf0f1;
}

.details-table td:first-child {
    width: 150px;
    color: #7f8c8d;
}

.invoice-items {
    margin: 40px 0;
}

.invoice-items h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.items-table th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.items-table td {
    padding: 15px;
    border-bottom: 1px solid #ecf0f1;
    color: #2c3e50;
}

.items-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.items-table tr:hover {
    background-color: #e3f2fd;
}

.total-row {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
    font-weight: bold;
}

.total-row td {
    padding: 20px 15px;
    font-size: 1.1rem;
    color: #2c3e50 !important;
}

.invoice-actions {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #ecf0f1;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Print styles for invoice view */
@media print {
    .nav-links, .invoice-actions {
        display: none !important;
    }
    
    .invoice-view {
        box-shadow: none;
        border-radius: 0;
        padding: 20px;
    }
    
    body {
        background: white;
        padding: 0;
        margin: 0;
    }
    
    .container {
        max-width: none;
        background: white;
        box-shadow: none;
        border-radius: 0;
    }
}
