:root {
    --primary-color: #003e7c;
    --secondary-color: #07c0c1;
    --accent-color: #07c0c1;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --dark-color: #1e293b;
    --light-color: #ffffff;
    --border-color: #e2e8f0;
    --light-blue: #f0fdfd;
    --fragote-blue: #003e7c;
    --fragote-teal: #07c0c1;
    --fragote-light-teal: rgba(7, 192, 193, 0.1);
    --gradient-bg: linear-gradient(135deg, #003e7c 0%, #07c0c1 100%);
    --card-shadow: 0 10px 25px -5px rgba(0, 62, 124, 0.2), 0 4px 6px -2px rgba(0, 62, 124, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.2);
}

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

body {
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    background: var(--gradient-bg);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    color: var(--dark-color);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo img {
    height: 45px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav a {
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    text-align: center;
    letter-spacing: 0.025em;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(37, 99, 235, 0.4);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.qr-scanner {
    text-align: center;
    padding: 2rem;
}

#video {
    width: 100%;
    max-width: 500px;
    height: 350px;
    border: 3px solid var(--primary-color);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    box-shadow: var(--card-shadow);
    object-fit: cover;
}

.scanner-controls {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.result-display {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    text-align: left;
    box-shadow: var(--card-shadow);
}

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

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

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.9);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-color: white;
}

.table {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.table th,
.table td {
    padding: 0.875rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.table th {
    background: linear-gradient(135deg, var(--fragote-blue), var(--fragote-teal));
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--fragote-light-teal);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 62, 124, 0.1);
}

.table tbody tr:nth-child(even) {
    background-color: rgba(247, 250, 252, 0.5);
}

.table tbody tr:nth-child(even):hover {
    background-color: var(--fragote-light-teal);
}

/* Column-specific widths for better layout */
.table th:nth-child(1), .table td:nth-child(1) { width: 140px; min-width: 140px; } /* NC Code */
.table th:nth-child(2), .table td:nth-child(2) { width: 180px; min-width: 180px; } /* Name */
.table th:nth-child(3), .table td:nth-child(3) { width: 200px; min-width: 200px; } /* Email */
.table th:nth-child(4), .table td:nth-child(4) { width: 140px; min-width: 140px; } /* Company */
.table th:nth-child(5), .table td:nth-child(5) { width: 160px; min-width: 160px; } /* Position */
.table th:nth-child(6), .table td:nth-child(6) { width: 120px; min-width: 120px; } /* Phone */
.table th:nth-child(7), .table td:nth-child(7) { width: 150px; min-width: 150px; } /* Comments */
.table th:nth-child(8), .table td:nth-child(8) { width: 100px; min-width: 100px; } /* Inserted */
.table th:nth-child(9), .table td:nth-child(9) { width: 100px; min-width: 100px; } /* Created */
.table th:nth-child(10), .table td:nth-child(10) { width: 120px; min-width: 120px; } /* Actions */

.table-responsive {
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: visible;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Better text truncation for long content */
.table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Allow wrapping for specific columns */
.table td:nth-child(2), /* Name */
.table td:nth-child(7) { /* Comments */
    white-space: normal;
    max-height: 60px;
    overflow: hidden;
}

.table td:nth-child(3) { /* Email column */
    white-space: nowrap;
}

/* Ensure action buttons are visible */
.table td:nth-child(10) {
    white-space: nowrap;
}

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-new {
    background-color: var(--light-blue);
    color: var(--fragote-blue);
    border: 1px solid var(--fragote-teal);
}

.status-contacted {
    background-color: #fef3c7;
    color: #92400e;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--card-shadow);
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-color);
}

.footer {
    margin-top: 4rem;
    padding: 3rem 0 2rem 0;
    background: linear-gradient(135deg, var(--fragote-blue) 0%, var(--fragote-teal) 100%);
    color: white;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

.footer-section a:hover {
    color: white;
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1.5rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

/* Improved responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav ul {
        gap: 1rem;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .card {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .scanner-controls {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
        padding: 1rem 1.5rem;
    }
    
    #video {
        max-width: 100%;
        height: 250px;
    }
    
    .modal-content {
        padding: 1.5rem;
        width: 95%;
        max-height: 85vh;
        overflow-y: auto;
        top: 10%;
        transform: translate(-50%, 0);
        border-radius: 12px;
        margin: 0;
    }
    
    .form-control {
        padding: 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Table responsiveness */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.8rem;
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .logo p {
        font-size: 0.8rem;
    }
    
    .footer {
        margin-top: 2rem;
        padding: 1.5rem 0;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .header {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .card {
        padding: 1rem;
    }
    
    .modal-content {
        padding: 1rem;
        width: 98%;
        max-height: 90vh;
        top: 5%;
        transform: translate(-50%, 0);
        border-radius: 8px;
    }
    
    .close {
        top: 0.5rem;
        right: 0.5rem;
        font-size: 1.8rem;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }
    
    .btn {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    .table th,
    .table td {
        padding: 0.4rem 0.2rem;
    }
    
    #video {
        height: 200px;
    }
    
    .logo img {
        height: 35px;
    }
    
    .logo h1 {
        font-size: 1.1rem;
    }
    
    .form-control {
        padding: 0.875rem;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    /* Details modal mobile improvements */
    #detailsModal .modal-content {
        padding: 1rem;
    }
    
    #detailsModal .modal-content > div {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }
    
    #detailsModal .modal-content strong {
        display: block;
        margin-bottom: 0.25rem;
        color: var(--fragote-blue);
    }
}