/* style.css (The Definitive, Final, and Complete Responsive Stylesheet for FlowForge) */

/* === FONT & ROOT VARIABLES === */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;700;800&display=swap');

:root {
    --primary-color: #005A9C;
    --secondary-color: #0D99FF;
    --accent-color: #e67e22;
    --danger-color: #c0392b;
    --success-color: #27ae60;
    --dark-color: #2c3e50;
    --light-color: #f8f9fa;
    --text-color: #34495e;
    --text-light: #7f8c8d;
    --border-color: #dee2e6;
    --card-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
    --hover-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    
    /* Responsive spacing */
    --container-padding: 15px;
    --card-padding: 20px;
    --nav-padding: 10px 0;
}

/* === RESPONSIVE BREAKPOINTS === */
@media (min-width: 576px) {
    :root {
        --container-padding: 20px;
        --card-padding: 25px;
    }
}

@media (min-width: 768px) {
    :root {
        --container-padding: 25px;
        --card-padding: 30px;
        --nav-padding: 15px 0;
    }
}

/* === GENERAL & BODY === */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Heebo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--light-color);
    color: var(--text-color);
    line-height: 1.7;
    font-weight: 400;
    font-size: clamp(14px, 2.5vw, 16px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px var(--container-padding);
    width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--dark-color);
    margin-top: 0;
    margin-bottom: 0.75em;
    line-height: 1.3;
}

/* Responsive typography */
h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: clamp(1.3rem, 3vw, 1.5rem); }

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}
a:hover {
    color: var(--accent-color);
}

/* === RESPONSIVE NAVIGATION BAR === */
nav {
    background: #fff;
    padding: var(--nav-padding);
    box-shadow: 0 2px 5px rgba(0,0,0,0.07);
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

@media (min-width: 768px) {
    nav {
        margin-bottom: 30px;
    }
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    font-size: clamp(1.3em, 4vw, 1.8em);
    font-weight: 800;
    color: var(--primary-color);
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media (min-width: 576px) {
    nav ul {
        gap: 15px;
    }
}

nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    padding: 8px 10px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    white-space: nowrap;
}

@media (min-width: 576px) {
    nav ul li a {
        padding: 8px 12px;
        font-size: 1rem;
    }
}

nav ul li a:hover, nav ul li a.active {
    background-color: var(--light-color);
    color: var(--primary-color);
}

/* Mobile menu toggle (if needed) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
}

@media (max-width: 575px) {
    .nav-toggle {
        display: block;
    }
    
    nav ul {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin-top: 15px;
    }
    
    nav ul.active {
        display: flex;
    }
    
    nav ul li a {
        display: block;
        padding: 12px 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    nav ul li:last-child a {
        border-bottom: none;
    }
}

/* === RESPONSIVE BUTTONS === */
.btn {
    display: inline-block;
    padding: 10px 18px;
    background: var(--primary-color);
    color: white !important;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 90, 156, 0.2);
    text-align: center;
    min-width: 120px;
}

@media (min-width: 576px) {
    .btn {
        padding: 10px 22px;
        min-width: auto;
    }
}

.btn:hover {
    background: var(--dark-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: var(--text-light);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: var(--dark-color);
}

.btn-full {
    width: 100%;
    display: block;
}

@media (min-width: 576px) {
    .btn-full {
        width: auto;
        display: inline-block;
    }
}

/* === RESPONSIVE CARDS === */
.card {
    background: #fff;
    padding: var(--card-padding);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    width: 100%;
}

@media (min-width: 768px) {
    .card {
        margin-bottom: 30px;
    }
}

.card h1, .card h2 {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

/* Card grid system */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 576px) {
    .card-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .card-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .card-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .card-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* === RESPONSIVE FORMS === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: clamp(0.85em, 2vw, 0.9em);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="search"],
.form-group textarea,
.form-group select {
    display: block;
    width: 100%;
    padding: 12px 15px;
    box-sizing: border-box;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    font-family: 'Heebo', sans-serif;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

@media (max-width: 575px) {
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group input[type="search"],
    .form-group textarea,
    .form-group select {
        padding: 14px 15px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 90, 156, 0.15);
}

.form-group small {
    display: block;
    margin-top: 8px;
    color: var(--text-light);
    font-size: clamp(0.8rem, 2vw, 0.9rem);
}

/* Form row layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 576px) {
    .form-row-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .form-row-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* === RESPONSIVE ALERTS & MESSAGES === */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* === RESPONSIVE TABLES === */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Minimum width before horizontal scroll */
}

@media (min-width: 768px) {
    table {
        min-width: 100%;
    }
}

table thead tr th {
    text-align: right;
    border-bottom: 2px solid var(--dark-color);
    padding: 8px;
    font-size: clamp(0.8em, 2vw, 0.9em);
    text-transform: uppercase;
    color: var(--text-light);
    white-space: nowrap;
}

@media (min-width: 576px) {
    table thead tr th {
        padding: 12px;
    }
}

body[data-lang="en"] table thead tr th {
    text-align: left;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody td {
    padding: 10px 8px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    font-size: clamp(0.9rem, 2.5vw, 1rem);
}

@media (min-width: 576px) {
    table tbody td {
        padding: 15px 12px;
    }
}

/* RTL/LTR support */
body[dir="rtl"] table thead th {
    text-align: right;
}

body[dir="ltr"] table thead th {
    text-align: left;
}

/* Stack table on very small screens */
@media (max-width: 575px) {
    .table-responsive-stack {
        min-width: auto;
    }
    
    .table-responsive-stack thead {
        display: none;
    }
    
    .table-responsive-stack tbody,
    .table-responsive-stack tr,
    .table-responsive-stack td {
        display: block;
        width: 100%;
    }
    
    .table-responsive-stack tr {
        border: 1px solid var(--border-color);
        margin-bottom: 15px;
        border-radius: 6px;
        overflow: hidden;
    }
    
    .table-responsive-stack td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        padding: 12px 15px;
        text-align: left;
        position: relative;
        padding-left: 50%;
    }
    
    .table-responsive-stack td:before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: var(--text-light);
    }
    
    .table-responsive-stack td:last-child {
        border-bottom: none;
    }
}

/* === UTILITY CLASSES === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

@media (min-width: 576px) {
    .d-sm-block { display: block; }
    .d-sm-none { display: none; }
    .d-sm-flex { display: flex; }
}

@media (min-width: 768px) {
    .d-md-block { display: block; }
    .d-md-none { display: none; }
    .d-md-flex { display: flex; }
}

@media (min-width: 992px) {
    .d-lg-block { display: block; }
    .d-lg-none { display: none; }
    .d-lg-flex { display: flex; }
}

/* Margin and padding utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

/* === ACCESSIBILITY IMPROVEMENTS === */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for better keyboard navigation */
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* === OTP LOGIN STYLES === */
.card-hero {
    max-width: 500px;
    margin: 40px auto;
    text-align: center;
}

.card-hero .subtitle {
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 1.1em;
}

.stacked-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.otp-context {
    background: #f0f7ff;
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: right;
}

.otp-context p {
    margin: 8px 0;
    color: var(--text-color);
}

.otp-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-ghost {
    background: transparent;
    color: var(--dark-color);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--light-color);
    color: var(--dark-color);
    border-color: var(--primary-color);
}

/* Remove buttons should be more visible */
button.btn-ghost[data-index],
button.btn-ghost[type="submit"] {
    color: var(--danger-color);
    border-color: var(--danger-color);
}

button.btn-ghost[data-index]:hover,
button.btn-ghost[type="submit"]:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

/* Sortable styles for form elements */
.sortable-ghost {
    opacity: 0.4;
    background: var(--light-color) !important;
    border: 2px dashed var(--primary-color) !important;
}

.sortable-chosen {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-color: var(--primary-color) !important;
}

.element-row {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.element-row:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}

.helper-text {
    font-size: 0.85em;
    color: var(--text-light);
    margin-top: 15px;
    text-align: center;
}

/* OTP Input Styling */
input[type="text"][inputmode="numeric"] {
    font-family: 'Courier New', monospace;
    font-size: 1.5em;
    letter-spacing: 0.3em;
    text-align: center;
    font-weight: 600;
}

/* === ENHANCED CARD STYLES === */
.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

/* === TEAM BADGES === */
.team-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin: 0 5px;
}

/* === FORM WIZARD STYLES === */
.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* === DASHBOARD ENHANCEMENTS === */
.page-heading {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.page-heading .eyebrow {
    text-transform: uppercase;
    font-size: 0.85em;
    color: var(--text-light);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.quick-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.quick-actions h3 {
    margin-bottom: 5px;
}

.quick-actions p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.9em;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.card-table {
    margin-bottom: 30px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state p {
    font-size: 1.1em;
    margin: 0;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.table-actions .btn {
    padding: 6px 12px;
    font-size: 0.9em;
    min-width: auto;
}

.pill {
    display: inline-block;
    background: var(--light-color);
    color: var(--text-color);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
}

/* === PRINT STYLES === */
@media print {
    nav,
    .btn,
    .alert {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
}