/* =====================================================
   NIKA Brand Colors & CSS Variables
   ===================================================== */
:root {
    /* Primary Colors */
    --primary-blue: #1E88E5;
    --primary-blue-dark: #1565C0;
    --primary-blue-light: #42A5F5;

    /* Accent Colors */
    --accent-cyan: #00BCD4;
    --accent-cyan-light: #4DD0E1;
    --accent-turquoise: #26C6DA;

    /* Neutral Colors */
    --white: #FFFFFF;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    /* Status Colors */
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
}

/* =====================================================
   Reset & Base Styles
   ===================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--gray-800);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    min-height: 100vh;
}

/* =====================================================
   Page Transitions
   ===================================================== */
.page {
    display: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.page.active {
    display: block;
    opacity: 1;
}

/* =====================================================
   Login Page
   ===================================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-cyan) 100%);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-section {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-image {
    max-width: 180px;
    height: auto;
    margin-bottom: 0.5rem;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.tagline {
    color: var(--gray-500);
    font-size: 0.9375rem;
    font-weight: 400;
}

/* =====================================================
   Form Styles
   ===================================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-group label .required {
    color: var(--error);
    margin-left: 2px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    outline: none;
}

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover {
    border-color: var(--gray-300);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--gray-400);
}

.form-group input.error,
.form-group textarea.error,
.form-group select.error {
    border-color: var(--error);
}

.form-group input.error:focus,
.form-group textarea.error:focus,
.form-group select.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.error-message {
    display: block;
    font-size: 0.8125rem;
    color: var(--error);
    margin-top: 0.375rem;
    min-height: 1.25rem;
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px 0 rgba(30, 136, 229, 0.35);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-blue-light) 0%, var(--primary-blue) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(30, 136, 229, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-outline {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-blue);
    color: var(--white);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.0625rem;
}

.login-form .btn {
    width: 100%;
    margin-top: 0.5rem;
}

/* Loading Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =====================================================
   Header
   ===================================================== */
.header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header .logo {
    font-size: 1.75rem;
    margin: 0;
}

.header-logo {
    height: 40px;
    width: auto;
}

/* =====================================================
   Main Content & Form Container
   ===================================================== */
.main-content {
    padding: 2rem 1.5rem;
    min-height: calc(100vh - 160px);
}

.form-container {
    max-width: 700px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.form-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-cyan) 100%);
    color: var(--white);
    padding: 2rem 2.5rem;
}

.form-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.company-badge {
    font-size: 0.875rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.form-header p {
    opacity: 0.9;
    font-size: 0.9375rem;
}

.project-form {
    padding: 2rem 2.5rem;
}

.form-section {
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 2.5rem;
}

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

.form-section .form-group {
    margin-bottom: 0;
}

.form-actions {
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
    margin-top: 1.5rem;
}

.form-actions .btn {
    width: 100%;
}

/* =====================================================
   Footer
   ===================================================== */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* =====================================================
   Modal
   ===================================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    text-align: center;
    max-width: 400px;
    width: 100%;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.modal-icon.success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: var(--white);
}

.modal-icon svg {
    width: 32px;
    height: 32px;
}

.modal-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
}

.modal-content p {
    color: var(--gray-600);
    margin-bottom: 1.5rem;
}

.modal-content .btn {
    min-width: 120px;
}

/* =====================================================
   Responsive Design
   ===================================================== */
@media (max-width: 640px) {
    .login-card {
        padding: 2rem 1.5rem;
    }

    .logo {
        font-size: 2rem;
    }

    .form-header {
        padding: 1.5rem;
    }

    .form-header h2 {
        font-size: 1.25rem;
    }

    .project-form {
        padding: 1.5rem;
    }

    .header-content {
        padding: 0.875rem 1rem;
    }

    .header .logo {
        font-size: 1.5rem;
    }

    .main-content {
        padding: 1rem;
    }

    .form-container {
        border-radius: var(--radius-lg);
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
    }

    .btn-large {
        padding: 0.875rem 1.5rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.75rem;
        font-size: 1rem;
    }
}

/* =====================================================
   Utility Classes
   ===================================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible for accessibility */
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* =====================================================
   Radio Buttons
   ===================================================== */
.radio-group {
    display: flex;
    gap: 2rem;
    margin-top: 0.75rem;
}

.radio-option {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.radio-option:hover {
    border-color: var(--primary-blue-light);
    background: var(--gray-50);
}

.radio-option:has(input:checked) {
    border-color: var(--primary-blue);
    background: rgba(30, 136, 229, 0.05);
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    margin-right: 0.5rem;
    cursor: pointer;
    accent-color: var(--primary-blue);
    flex-shrink: 0;
}

.radio-label {
    font-size: 1rem;
    color: var(--gray-700);
    line-height: 1;
}

/* =====================================================
   Product Rows
   ===================================================== */
#products-container {
    margin-bottom: 1rem;
}

.product-row {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    animation: slideIn 0.2s ease;
}

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

.product-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.product-row-number {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.product-row-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.product-row-fields .field-group {
    display: flex;
    flex-direction: column;
}

.product-row-fields .field-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

.product-row-fields .field-group select,
.product-row-fields .field-group input {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
}

.product-row-fields .field-group select:focus,
.product-row-fields .field-group input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.15);
    outline: none;
}

.btn-remove-product {
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-remove-product:hover {
    background: var(--error);
    color: var(--white);
}

.btn-remove-product svg {
    width: 18px;
    height: 18px;
    display: block;
}

#add-product-btn {
    margin-top: 0.5rem;
}

/* Responsive product rows */
@media (max-width: 640px) {
    .product-row-fields {
        grid-template-columns: 1fr;
    }

    .product-row {
        padding: 0.875rem;
    }
}
