/* ============================================
   SPINOTO INSPECTION SYSTEM
   Brand Colors: #16b994 (Primary) | #07115a (Secondary)
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #16b994;
    --primary-dark: #12a082;
    --primary-light: #1fd4ac;
    --secondary: #07115a;
    --secondary-light: #0a1b7a;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Alert Messages */
.alert {
    padding: 1rem 1.5rem;
    margin: 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    animation: slideDown 0.3s ease;
    box-shadow: var(--shadow-md);
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* SPINOTO BRANDED HEADER */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1.5rem 1.5rem 1rem;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.header-logo {
    width: 55px;
    height: 55px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    letter-spacing: -2px;
}

.header-text h1 {
    font-size: 1.9rem;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    letter-spacing: 1px;
}

.header-text p {
    font-size: 0.85rem;
    opacity: 0.95;
    margin: 0;
    font-weight: 400;
}

.header-nav {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
}

.header-nav::-webkit-scrollbar {
    height: 4px;
}

.header-nav::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.header-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.header-nav a {
    color: white;
    text-decoration: none;
    padding: 0.65rem 1.2rem;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
}

.header-nav a:hover,
.header-nav a.active {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.4);
}

/* Form Cards */
.inspection-form {
    padding: 1.5rem 1rem;
    flex: 1;
}

.form-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.form-card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 3px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to right, rgba(22,185,148,0.08), transparent);
}

.card-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(22,185,148,0.3);
}

/* Form Grid */
.form-grid {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.85rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s;
    background: white;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(22, 185, 148, 0.1);
}

.form-group select:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
    opacity: 0.6;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #94a3b8;
}

/* Checklist Container */
.checklist-container {
    padding: 1.5rem 1rem;
}

.category-section {
    margin-bottom: 2rem;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(22, 185, 148, 0.35);
}

.category-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.category-count {
    background: rgba(255,255,255,0.25);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* Check Items */
.check-item {
    background: linear-gradient(to bottom, #ffffff, #fafbfc);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s;
}

.check-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(22, 185, 148, 0.15);
    transform: translateY(-2px);
}

.check-info h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 0.4rem;
}

.check-info p {
    font-size: 0.88rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Status Selector */
.status-selector {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.status-option {
    flex: 1;
    cursor: pointer;
}

.status-option input[type="radio"] {
    display: none;
}

.status-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: white;
}

.status-option.ok .status-label {
    color: var(--success);
}

.status-option.not-ok .status-label {
    color: var(--danger);
}

.status-option input:checked + .status-label {
    border-width: 3px;
    transform: scale(1.03);
}

.status-option.ok input:checked + .status-label {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border-color: var(--success);
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}

.status-option.not-ok input:checked + .status-label {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-color: var(--danger);
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.3);
}

/* Recommendation Box */
.recommendation-box textarea {
    width: 100%;
    padding: 0.85rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
    transition: all 0.2s;
}

.recommendation-box textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(22, 185, 148, 0.1);
}

/* Submit Section */
.submit-section {
    padding: 1.5rem 1rem;
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, var(--bg-light), rgba(248,250,252,0.95));
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
    backdrop-filter: blur(10px);
}

.submit-btn {
    width: 100%;
    padding: 1.1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s;
    box-shadow: 0 6px 20px rgba(22, 185, 148, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(22, 185, 148, 0.5);
}

.submit-btn:active {
    transform: scale(0.98);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Dashboard Stats */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 1.5rem 1rem;
}

@media (min-width: 640px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: white;
    padding: 2rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
    border-top: 4px solid var(--primary);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(22,185,148,0.05), transparent);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card h3 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: var(--text-gray);
    font-size: 0.95rem;
    font-weight: 600;
}

/* Table Styles */
.data-table {
    width: calc(100% - 2rem);
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin: 1rem;
    border: 1px solid var(--border);
}

.data-table h2 {
    color: var(--secondary);
    padding: 1.5rem 1.5rem 0;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: rgba(22, 185, 148, 0.05);
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .app-header {
        padding: 1rem;
    }
    
    .header-logo {
        width: 45px;
        height: 45px;
        font-size: 1.6rem;
    }
    
    .header-text h1 {
        font-size: 1.5rem;
    }
    
    .header-text p {
        font-size: 0.75rem;
    }
    
    .inspection-form {
        padding: 1rem 0.5rem;
    }
    
    .form-card {
        border-radius: var(--radius-md);
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .card-header h2 {
        font-size: 1.1rem;
    }
    
    .form-grid {
        padding: 1rem;
    }
    
    .checklist-container {
        padding: 1rem 0.5rem;
    }
    
    .check-item {
        padding: 1rem;
    }
    
    .status-selector {
        flex-direction: column;
    }
    
    .stat-card h3 {
        font-size: 2.2rem;
    }
    
    .data-table {
        width: calc(100% - 1rem);
        margin: 0.5rem;
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Print Styles */
@media print {
    .app-header,
    .header-nav,
    .submit-section {
        display: none;
    }
    
    .form-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
