/*
 * INFINITE RENOVATIONS - V3: Warm Terracotta & Espresso
 * DEV MODE: components.css v2.0
 */

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: none;
    border-radius: 0;
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all var(--transition-normal);
    outline: none;
    text-decoration: none;
    white-space: nowrap;
}

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

/* Primary Button */
.btn-primary {
    background: var(--blue-primary);
    color: var(--text-primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--blue-hover);
    transform: scale(1.02);
}

/* Secondary Button */
.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
}

/* Success Button */
.btn-success {
    background: var(--green-success);
    color: var(--bg-primary);
}

.btn-success:hover:not(:disabled) {
    filter: brightness(1.1);
}

/* Danger Button */
.btn-danger {
    background: var(--red-danger);
    color: var(--text-primary);
}

.btn-danger:hover:not(:disabled) {
    filter: brightness(1.1);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-md);
}

.btn-full {
    width: 100%;
}

/* ========================================
   CARDS
   ======================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: var(--space-6);
    margin-bottom: var(--space-5);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
}

.card-title {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
}

.card-subtitle {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

/* ========================================
   STATUS CHIPS
   ======================================== */

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: 0;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    white-space: nowrap;
}

.status-chip.scheduled {
    background: rgba(153, 69, 255, 0.15);
    color: var(--purple-info);
}

.status-chip.in-progress {
    background: rgba(67, 223, 167, 0.15);
    color: var(--green-success);
}

.status-chip.waiting {
    background: rgba(255, 152, 50, 0.15);
    color: var(--orange-warning);
}

.status-chip.complete {
    background: rgba(114, 240, 68, 0.15);
    color: var(--teal-accent);
}

.status-chip.at-risk,
.status-chip.late {
    background: rgba(255, 118, 131, 0.15);
    color: var(--red-danger);
}

.status-chip.off-site {
    background: rgba(255, 118, 131, 0.15);
    color: var(--red-danger);
}

.status-chip.on-site {
    background: rgba(67, 223, 167, 0.15);
    color: var(--green-success);
}

/* ========================================
   TYPE CHIPS (Job Types)
   ======================================== */

.type-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    border-radius: 0;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    background: var(--bg-primary);
}

.type-chip.roofing {
    color: var(--blue-primary);
}

.type-chip.renovation {
    color: var(--purple-info);
}

/* ========================================
   AVATARS
   ======================================== */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    font-weight: var(--font-semibold);
    background: linear-gradient(135deg, #D4845A, #F5D5B8);
    color: var(--text-primary);
    flex-shrink: 0;
}

.avatar-sm {
    width: 24px;
    height: 24px;
    font-size: var(--text-xs);
}

.avatar-md {
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
}

.avatar-lg {
    width: 40px;
    height: 40px;
    font-size: var(--text-md);
}

.avatar-xl {
    width: 48px;
    height: 48px;
    font-size: var(--text-lg);
}

/* Avatar with specific colors */
.avatar.orange {
    background: linear-gradient(135deg, var(--orange-warning), var(--red-danger));
}

.avatar.green {
    background: linear-gradient(135deg, var(--green-success), var(--teal-accent));
}

.avatar.purple {
    background: linear-gradient(135deg, var(--purple-info), var(--blue-primary));
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: var(--text-md);
    outline: none;
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--blue-primary);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-secondary);
}

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

/* ========================================
   CHECKBOXES
   ======================================== */

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}

.checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.checkbox.checked {
    background: var(--green-success);
    border-color: var(--green-success);
}

.checkbox.checked::after {
    content: '\2713';
    color: var(--bg-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
}

/* ========================================
   TOGGLE SWITCHES
   ======================================== */

.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--border-color);
    border-radius: var(--space-3);
    cursor: pointer;
    transition: background var(--transition-slow);
    flex-shrink: 0;
}

.toggle-switch.active {
    background: var(--green-success);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--text-primary);
    border-radius: var(--radius-full);
    transition: transform var(--transition-slow);
}

.toggle-switch.active::after {
    transform: translateX(24px);
}

/* ========================================
   TABLES
   ======================================== */

.table-container {
    overflow-x: auto;
}

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

thead {
    border-bottom: 1px solid var(--border-color);
}

th {
    text-align: left;
    padding: var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-md);
}

tr:hover {
    background: var(--bg-hover);
}

/* ========================================
   PROGRESS BAR
   ======================================== */

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 0;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #D4845A, #F5D5B8);
    border-radius: 0;
    transition: width var(--transition-slow);
}

/* ========================================
   TIMELINE
   ======================================== */

.timeline {
    position: relative;
    padding-left: var(--space-8);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-6);
}

.timeline-dot {
    position: absolute;
    left: -28px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 0;
    background: var(--border-color);
}

.timeline-dot.complete {
    background: var(--green-success);
}

.timeline-dot.current {
    background: var(--blue-primary);
    box-shadow: 0 0 0 4px rgba(212, 132, 90, 0.3);
}

.timeline-dot.pending {
    background: var(--border-color);
}

.timeline-title {
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-1);
}

.timeline-date {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ========================================
   MESSAGES / CHAT
   ======================================== */

.message-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: 0;
    margin-bottom: var(--space-2);
    transition: background var(--transition-normal);
}

.message-item:hover {
    background: var(--bg-hover);
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-sender {
    font-weight: var(--font-semibold);
    font-size: var(--text-md);
    margin-bottom: var(--space-1);
}

.message-text {
    font-size: var(--text-base);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-time {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.message-unread {
    position: relative;
}

.message-unread::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--red-danger);
    border-radius: 0;
}

/* Chat Bubbles */
.chat-bubble {
    padding: var(--space-3) var(--space-4);
    border-radius: 0;
    background: var(--bg-card);
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    max-width: 80%;
}

.chat-bubble.sent {
    background: var(--blue-primary);
    margin-left: auto;
}

.chat-bubble.received {
    background: var(--bg-hover);
}

/* ========================================
   ALERTS
   ======================================== */

.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-primary);
    border-radius: 0;
    margin-bottom: var(--space-2);
}

.alert-icon {
    width: 24px;
    height: 24px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: var(--text-sm);
}

.alert-icon.warning {
    background: rgba(255, 152, 50, 0.2);
    color: var(--orange-warning);
}

.alert-icon.danger {
    background: rgba(255, 118, 131, 0.2);
    color: var(--red-danger);
}

.alert-icon.info {
    background: rgba(212, 132, 90, 0.2);
    color: var(--blue-primary);
}

.alert-icon.success {
    background: rgba(67, 223, 167, 0.2);
    color: var(--green-success);
}

.alert-text {
    font-size: var(--text-base);
    line-height: var(--leading-normal);
}

/* ========================================
   TASK ITEMS
   ======================================== */

.task-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-primary);
    border-radius: 0;
    margin-bottom: var(--space-2);
}

.task-text {
    flex: 1;
    font-size: var(--text-md);
}

.task-text.completed {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.task-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.task-due {
    padding: var(--space-1) var(--space-2);
    background: var(--bg-card);
    border-radius: 0;
}

/* ========================================
   MEDIA GRID
   ======================================== */

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-4);
}

.media-item {
    aspect-ratio: 4/3;
    border-radius: 0;
    background: linear-gradient(135deg, #3D352E, #2B2520);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-normal);
}

.media-item:hover {
    transform: scale(1.03);
}

.media-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-3);
    background: linear-gradient(to top, rgba(43,37,32,0.8), transparent);
}

.media-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-1);
}

.media-meta {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* ========================================
   DOCUMENT LIST
   ======================================== */

.doc-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-primary);
    border-radius: 0;
    margin-bottom: var(--space-2);
}

.doc-icon {
    width: 40px;
    height: 40px;
    border-radius: 0;
    background: var(--red-danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
}

.doc-info {
    flex: 1;
}

.doc-name {
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-1);
}

.doc-size {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ========================================
   BADGES
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 var(--space-2);
    border-radius: 0;
    background: var(--red-danger);
    color: var(--text-primary);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
}

.badge.success {
    background: var(--green-success);
}

.badge.warning {
    background: var(--orange-warning);
}

.badge.info {
    background: var(--blue-primary);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--green-success); }
.text-warning { color: var(--orange-warning); }
.text-danger { color: var(--red-danger); }
.text-info { color: var(--purple-info); }

/* Font Weights */
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* Margin */
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }

/* Padding */
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* Width */
.w-full { width: 100%; }

/* Hidden */
.hidden { display: none; }
