/**
 * inFLOW by inTEC Group
 * Site-wide styles (3CX Admin Portal style)
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #2d3748;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: white;
    letter-spacing: -0.5px;
}

.logo:hover {
    opacity: 0.9;
}

.header-brand {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 500;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-user-info {
    text-align: right;
}

.header-user-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.header-user-role {
    font-size: 0.75rem;
    opacity: 0.9;
}

.header-user-role .role-badge {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

.btn-logout {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

.nav {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 0;
    align-items: stretch;
}

/* Admin dropdown on the right (3CX-style) */
.nav-admin {
    margin-left: auto;
    position: relative;
    display: flex;
    align-items: stretch;
}

.nav-admin-trigger {
    display: inline-flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: #4a5568;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-admin-trigger:hover,
.nav-admin-trigger.active {
    color: #667eea;
    background: #f7fafc;
}

.nav-admin-trigger.active {
    border-bottom-color: #667eea;
}

.nav-admin-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    display: none;
    z-index: 100;
}

.nav-admin-menu.open {
    display: block;
}

.nav-admin-menu a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
    border-radius: 0;
    border-bottom: none;
    transition: background 0.2s;
}

.nav-admin-menu a:hover {
    background: #f7fafc;
    color: #667eea;
}

.nav-admin-menu a.active {
    background: #edf2f7;
    color: #667eea;
    border-bottom: none;
}

.nav a {
    display: inline-block;
    padding: 1rem 1.5rem;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.nav a:hover {
    color: #667eea;
    background: #f7fafc;
}

.nav a.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #f7fafc;
}

.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem 4rem;
    flex: 1 0 auto;
    width: 100%;
}

.container > * {
    width: 100%;
}

.page-title {
    margin-bottom: 2rem;
}

.page-title h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #1a202c;
    font-weight: 700;
}

.page-title p {
    color: #718096;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    padding: 2rem;
    margin-bottom: 2rem;
    width: 100%;
}

.card-header {
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.5rem;
    color: #1a202c;
    font-weight: 700;
}

/* Tabs (e.g. Settings) */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.tabs a {
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: #4a5568;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tabs a:hover {
    color: #667eea;
    background: #f7fafc;
}

.tabs a.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #f7fafc;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1.5;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-outline-primary {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline-primary:hover {
    background: #667eea;
    color: white;
}

.btn-outline-danger {
    background: transparent;
    color: #f56565;
    border: 2px solid #f56565;
}

.btn-outline-danger:hover {
    background: #f56565;
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    font-weight: 500;
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
    border-color: #38a169;
}

.alert-danger, .alert-error {
    background: #fed7d7;
    color: #742a2a;
    border-color: #e53e3e;
}

.alert-warning {
    background: #feebc8;
    color: #744210;
    border-color: #ed8936;
}

.alert-info {
    background: #bee3f8;
    color: #2c5282;
    border-color: #3182ce;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table thead th {
    background: #f7fafc;
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    color: #2d3748;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

table tbody td {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody tr:hover {
    background: #f7fafc;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control:disabled {
    background: #f7fafc;
    color: #a0aec0;
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    border-left: 4px solid #667eea;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: #718096;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1;
}

.badge {
    display: inline-block;
    padding: 0.35rem 0.875rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success {
    background: #c6f6d5;
    color: #22543d;
}

.badge-danger {
    background: #fed7d7;
    color: #742a2a;
}

.badge-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.table-responsive {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
}

.footer {
    background: #2d3748;
    color: white;
    padding: 2rem;
    text-align: center;
    margin-top: auto;
}

.footer p {
    margin: 0;
}

.footer-version {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #a0aec0;
}

.text-muted {
    color: #718096;
}

.small, small {
    font-size: 0.875rem;
}

code {
    background: #f7fafc;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.login-wrapper {
    max-width: 420px;
    margin: 2rem auto;
}

.login-wrapper .card {
    padding: 2rem;
}

.login-wrapper .card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #1a202c;
}

@media (max-width: 768px) {
    .header-container,
    .nav-container,
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .stat-card .value {
        font-size: 2rem;
    }

    table {
        font-size: 0.875rem;
    }

    .actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .tabs {
        overflow-x: auto;
    }

    .tabs a {
        white-space: nowrap;
    }
}
