/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: #333;
}

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

/* Navigation */
.navbar {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: #667eea;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: #666;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s;
}

.nav-link:hover {
    background: #f0f0f0;
    color: #333;
}

.nav-link.active {
    background: #667eea;
    color: white;
}

.nav-user {
    color: #333;
    font-weight: 500;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

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

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Dashboard */
.dashboard-header {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h2 {
    color: #333;
    font-size: 2rem;
}

.subtitle {
    color: #666;
    margin-top: 0.5rem;
}

/* Branch Cards */
.branches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.branch-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.branch-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.branch-card.disabled {
    opacity: 0.6;
}

.disabled-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(220, 53, 69, 0.9);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
}

.branch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.branch-header h3 {
    color: #333;
    font-size: 1.5rem;
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-online {
    background: #d4edda;
    color: #155724;
}

.status-offline {
    background: #f8d7da;
    color: #721c24;
}

.status-Ready {
    background: #d4edda;
    color: #155724;
}

.status-In-Use {
    background: #fff3cd;
    color: #856404;
}

.status-Error {
    background: #f8d7da;
    color: #721c24;
}

.branch-info {
    margin-bottom: 1rem;
}

.branch-message {
    color: #666;
    margin-bottom: 0.5rem;
}

.branch-url {
    font-size: 0.875rem;
}

.branch-url a {
    color: #667eea;
    text-decoration: none;
}

.branch-url a:hover {
    text-decoration: underline;
}

.branch-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Branch Detail */
.branch-detail-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.branch-detail-card h3 {
    margin-bottom: 1.5rem;
    color: #333;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-item label {
    font-weight: 600;
    color: #666;
    font-size: 0.875rem;
}

.info-item span {
    color: #333;
}

.status-text-online {
    color: #28a745;
    font-weight: 600;
}

.status-text-offline {
    color: #dc3545;
    font-weight: 600;
}

.iframe-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.iframe-container h3 {
    margin-bottom: 1rem;
}

.iframe-container iframe {
    border: 1px solid #ddd;
    border-radius: 6px;
}

.actions-section {
    display: flex;
    gap: 1rem;
    justify-content: center;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Sticky actions for settings pages */
.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 999;
    margin-top: 2rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    border-top: 2px solid #667eea;
}

.sticky-actions.btn-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Refresh Section */
.refresh-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.last-updated {
    color: #666;
    font-size: 0.875rem;
}

/* User Management */
.user-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-form h3 {
    margin-bottom: 1.5rem;
    color: #333;
}

.permissions-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
}

.permissions-section h4 {
    margin-bottom: 1rem;
    color: #333;
}

.permission-group {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.permission-group h5 {
    margin-bottom: 0.75rem;
    color: #667eea;
}

.permission-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #666;
}

.permission-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

/* Users Table */
.users-table {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

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

.users-table th {
    background: #667eea;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.users-table td {
    padding: 1rem;
    border-bottom: 1px solid #ddd;
}

.users-table tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: #667eea;
    color: white;
}

.badge-user {
    background: #6c757d;
    color: white;
}

.perm-badge {
    display: inline-block;
    margin: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    border: 6px solid transparent;
    border-bottom-color: #333;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0px);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .branches-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .refresh-section {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    /* Adjust tooltips for mobile */
    [data-tooltip]::before {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}
