/* KAS Reseller Frontend Styles */

/* Login Page */
.kas-reseller-login-container {
    max-width: 450px;
    margin: 80px auto;
    padding: 20px;
}

.kas-reseller-login-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.kas-reseller-login-box h2 {
    margin-top: 0;
    margin-bottom: 30px;
    text-align: center;
    color: #333;
    font-size: 28px;
}

.kas-reseller-login-box .form-group {
    margin-bottom: 20px;
}

.kas-reseller-login-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.kas-reseller-login-box .form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.kas-reseller-login-box .form-control:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.kas-reseller-login-box .btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.kas-reseller-login-box .btn-primary {
    background-color: #0073aa;
    color: #fff;
    width: 100%;
}

.kas-reseller-login-box .btn-primary:hover {
    background-color: #005a87;
}

.kas-reseller-login-box .btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.login-message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.login-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.login-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Dashboard */
.kas-reseller-dashboard {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #0073aa;
}

.dashboard-header h1 {
    margin: 0;
    color: #333;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: #555;
    font-weight: 500;
}

.btn-logout {
    padding: 8px 16px;
    background-color: #dc3545;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background-color: #c82333;
    color: #fff;
}

.dashboard-filters {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-input,
.filter-select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-input {
    flex: 1;
    min-width: 250px;
}

.filter-select {
    min-width: 200px;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #0073aa;
}

/* Clients Table */
.clients-table-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.kas-clients-table {
    width: 100%;
    border-collapse: collapse;
}

.kas-clients-table thead {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.kas-clients-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.kas-clients-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #555;
}

.kas-clients-table tbody tr:hover {
    background-color: #f8f9fa;
}

.kas-clients-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status badges */
.kas-clients-table td[class*="status-"] {
    font-weight: 600;
}

.kas-clients-table td.status-active {
    color: #28a745;
}

.kas-clients-table td.status-inactive {
    color: #dc3545;
}

.kas-clients-table td.status-trial {
    color: #ffc107;
}

/* Action links */
.view-details {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.view-details:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .kas-reseller-login-container {
        margin: 40px auto;
        padding: 15px;
    }
    
    .kas-reseller-login-box {
        padding: 30px 20px;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .dashboard-filters {
        flex-direction: column;
    }
    
    .filter-input,
    .filter-select {
        width: 100%;
    }
    
    .kas-clients-table {
        font-size: 12px;
    }
    
    .kas-clients-table th,
    .kas-clients-table td {
        padding: 8px 6px;
    }
}

/* Empty state */
.kas-clients-table tbody tr td[colspan] {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* Modal Styles */
.kas-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
}

.kas-modal-content {
    background-color: #fff;
    margin: 5% auto;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kas-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #dee2e6;
}

.kas-modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 24px;
}

.kas-modal-close {
    color: #aaa;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.kas-modal-close:hover,
.kas-modal-close:focus {
    color: #000;
}

.kas-modal-body {
    padding: 25px;
    max-height: 600px;
    overflow-y: auto;
}

.kas-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 15px 25px;
    border-top: 1px solid #dee2e6;
    gap: 10px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

/* Installation Details */
.installation-details {
    padding: 10px 0;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 20px;
}

.client-info {
    color: #666;
    margin: 5px 0;
}

.detail-fields-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-fields-table tr {
    border-bottom: 1px solid #f0f0f0;
}

.detail-fields-table tr:last-child {
    border-bottom: none;
}

.detail-fields-table td {
    padding: 12px 10px;
    font-size: 14px;
}

.field-label {
    width: 35%;
    color: #555;
    vertical-align: top;
}

.field-value {
    color: #333;
}

.field-actions {
    width: 100px;
    text-align: right;
}

.field-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.field-input:focus {
    outline: none;
    border-color: #0073aa;
}

.field-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.field-checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px 8px;
    transition: opacity 0.3s;
}

.btn-icon:hover {
    opacity: 0.7;
}

.btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* Flash messages */
.kas-flash-message {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
    transition: opacity 0.3s ease-in-out;
}

.kas-flash-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.kas-flash-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Animated inline spinner used in modal */
.kas-modal-spinner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.04);
    border-radius: 6px;
    margin-bottom: 12px;
}
.kas-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
}
.kas-spinner span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 2px;
    background: #0073aa;
    border-radius: 50%;
    opacity: 0.3;
    transform: translateY(0);
    animation: kas-dot 1s infinite ease-in-out;
}
.kas-spinner span:nth-child(1) { animation-delay: 0s; }
.kas-spinner span:nth-child(2) { animation-delay: 0.15s; }
.kas-spinner span:nth-child(3) { animation-delay: 0.3s; }
@keyframes kas-dot {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.3; }
    40% { transform: translateY(-6px); opacity: 1; }
}
.kas-spinner-text {
    font-size: 14px;
    color: #333;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .kas-modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .detail-fields-table td {
        display: block;
        width: 100% !important;
        padding: 8px 10px;
    }
    
    .field-label {
        font-weight: bold;
        border-bottom: none;
    }
    
    .field-actions {
        text-align: left;
        border-top: 1px solid #f0f0f0;
        padding-top: 10px;
    }
}

.instr-trigger {
    cursor: help;
}