/* SKADI Sales Portal Styles */
/* Color Palette:
   - Dark Blue: #2a395c
   - Medium Blue: #5771b6
   - Orange Accent: #e76a2b
   - Off-White: #f9f9fa
*/

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f9f9fa;
    color: #2a395c;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, #2a395c 0%, #3d4f7a 100%);
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    box-shadow: 0 2px 10px rgba(42, 57, 92, 0.2);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #f9f9fa;
    font-weight: 600;
    font-size: 1.1rem;
}

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

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: rgba(249, 249, 250, 0.85);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: #f9f9fa;
}

.nav-user {
    color: rgba(249, 249, 250, 0.7);
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-logout {
    color: #e76a2b !important;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(42, 57, 92, 0.08);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.card-header h2 {
    color: #2a395c;
    font-size: 1.25rem;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    color: #2a395c;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #5771b6;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2a395c;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e4eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #5771b6;
    box-shadow: 0 0 0 3px rgba(87, 113, 182, 0.15);
}

.form-row {
    margin-bottom: 1rem;
}

.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-row-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

.form-section-header {
    margin: 2rem 0 1.5rem 0;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e4eb;
}

.form-section-header h3 {
    color: #2a395c;
    font-size: 1.1rem;
    font-weight: 600;
}

.input-with-prefix {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    background: #f0f3f8;
    border: 2px solid #e0e4eb;
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    color: #5771b6;
    font-weight: 500;
}

.input-with-prefix input {
    border-radius: 0 8px 8px 0;
    flex: 1;
}

.pricing-summary {
    background: linear-gradient(135deg, #2a395c 0%, #3d4f7a 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.pricing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.pricing-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pricing-row-total {
    padding-top: 1rem;
    margin-top: 0.5rem;
}

.pricing-label {
    color: rgba(249, 249, 250, 0.8);
    font-size: 0.95rem;
}

.pricing-row-total .pricing-label {
    color: #f9f9fa;
    font-weight: 600;
}

.pricing-value {
    color: #f9f9fa;
    font-size: 1.25rem;
    font-weight: 600;
}

.pricing-row-total .pricing-value {
    color: #e76a2b;
    font-size: 1.5rem;
}

.form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.form-info {
    background: #f0f3f8;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.form-info h4 {
    color: #2a395c;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-info ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.form-info li {
    color: #5771b6;
    font-size: 0.9rem;
}

.form-info li::before {
    content: "✓ ";
    color: #e76a2b;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #e76a2b 0%, #d55a1b 100%);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #d55a1b 0%, #c54a0b 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 106, 43, 0.3);
}

.btn-secondary {
    background: #f0f3f8;
    color: #2a395c;
    border: 2px solid #e0e4eb;
}

.btn-secondary:hover {
    background: #e0e4eb;
}

.btn-success {
    background: #28a745 !important;
    color: #fff !important;
}

.btn-block {
    width: 100%;
}

.btn-copy {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.copy-icon {
    font-size: 1rem;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

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

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-loading-state {
    opacity: 0.8;
    cursor: not-allowed;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* Script Output */
.script-output {
    margin-top: 2rem;
    padding: 0;
    overflow: hidden;
}

.script-output .card-header {
    margin: 0;
    padding: 1.5rem 2rem;
    border-bottom: none;
}

/* Script Tabs */
.script-tabs {
    display: flex;
    background: linear-gradient(135deg, #2a395c 0%, #3d4f7a 100%);
    padding: 0;
}

.script-tab {
    flex: 1;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: rgba(249, 249, 250, 0.7);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.script-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f9f9fa;
}

.script-tab.active {
    background: #fff;
    color: #2a395c;
}

.script-tab .tab-icon {
    font-size: 1.2rem;
}

.script-panel {
    display: none;
    padding: 0 2rem 2rem 2rem;
}

.script-panel.active {
    display: block;
}

.script-container {
    background: #1e2530;
    border-radius: 8px;
    overflow: auto;
    max-height: 500px;
}

.script-container pre {
    margin: 0;
    padding: 1.5rem;
}

.script-container code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #e0e4eb;
    white-space: pre;
    display: block;
}

.script-instructions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.script-instructions h4 {
    color: #2a395c;
    margin-bottom: 1rem;
}

.script-instructions ol {
    margin-left: 1.5rem;
    color: #5771b6;
}

.script-instructions li {
    margin-bottom: 0.5rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f0f3f8;
    color: #2a395c;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: #fafbfc;
}

.data-table .text-muted {
    color: #5771b6;
}

.data-table .text-accent {
    color: #e76a2b;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #5771b6;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 100px);
    padding: 2rem;
}

.login-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(42, 57, 92, 0.12);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    height: 80px;
    width: auto;
    margin-bottom: 1rem;
}

.login-header h1 {
    color: #2a395c;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #5771b6;
    font-size: 0.9rem;
}

.login-form .form-group input {
    text-align: center;
}

.login-form .form-group input#username,
.login-form .form-group input#password,
.login-form .form-group input#name,
.login-form .form-group input#email,
.login-form .form-group input#confirm_password {
    text-align: left;
}

/* Registration Page */
.register-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(42, 57, 92, 0.12);
    padding: 3rem;
    width: 100%;
    max-width: 480px;
}

.registration-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e4eb;
    color: #5771b6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: #5771b6;
    color: #fff;
}

.step.completed .step-number {
    background: #e76a2b;
    color: #fff;
}

.step.completed .step-number::after {
    content: "✓";
}

.step-label {
    font-size: 0.75rem;
    color: #5771b6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.step.active .step-label {
    color: #2a395c;
    font-weight: 600;
}

.step-line {
    width: 40px;
    height: 2px;
    background: #e0e4eb;
    margin: 0 0.5rem;
    margin-bottom: 1.5rem;
    transition: background 0.3s ease;
}

.step-line.active {
    background: #e76a2b;
}

.step-content {
    text-align: center;
    margin-bottom: 1.5rem;
}

.step-content h2 {
    color: #2a395c;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.step-description {
    color: #5771b6;
    font-size: 0.9rem;
}

.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.form-footer a {
    color: #5771b6;
    text-decoration: none;
}

.form-footer a:hover {
    color: #e76a2b;
}

.form-footer p {
    color: #5771b6;
    font-size: 0.9rem;
}

/* QR Code Section */
.qr-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.qr-code {
    width: 200px;
    height: 200px;
    border: 4px solid #2a395c;
    border-radius: 12px;
}

.totp-secret {
    text-align: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f0f3f8;
    border-radius: 8px;
}

.totp-secret p {
    color: #5771b6;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.totp-secret code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 1rem;
    color: #2a395c;
    background: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    display: inline-block;
    letter-spacing: 2px;
    font-weight: 600;
}

.totp-instructions {
    background: #f9f9fa;
    border: 1px solid #e0e4eb;
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.totp-instructions h4 {
    color: #2a395c;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.totp-instructions ol {
    margin: 0;
    padding-left: 1.25rem;
    color: #5771b6;
    font-size: 0.85rem;
}

.totp-instructions li {
    margin-bottom: 0.4rem;
}

/* Footer */
.footer {
    background: #2a395c;
    color: rgba(249, 249, 250, 0.6);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
        flex-direction: column;
        height: auto;
        padding: 1rem;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .form-row-2col,
    .form-row-3col {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1.5rem;
    }

    .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .form-info ul {
        flex-direction: column;
        gap: 0.5rem;
    }

    .script-tabs {
        flex-direction: column;
    }

    .script-tab {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .script-panel {
        padding: 0 1rem 1.5rem 1rem;
    }

    .script-output .card-header {
        padding: 1rem;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }
}
