/* CodeKiste Custom Authentication Styles */

.ck-login-form-container {
    max-width: 400px;
    margin: 40px auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
}

/* Header */
.ck-login-header {
    padding: 30px 30px 20px;
    text-align: center;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.ck-school-logo {
    margin-bottom: 20px;
}

.ck-school-logo img {
    max-width: 150px;
    max-height: 80px;
    object-fit: contain;
}

.ck-login-title {
    margin: 0;
    color: #495057;
    font-size: 1.5rem;
    font-weight: 600;
}

.ck-school-name {
    display: block;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: normal;
    margin-top: 5px;
}

/* Form fields */
.ck-login-fields {
    padding: 30px;
}

.ck-field {
    margin-bottom: 20px;
}

.ck-field label {
    display: block;
    margin-bottom: 6px;
    color: #495057;
    font-weight: 500;
    font-size: 14px;
}

.ck-field input[type="text"],
.ck-field input[type="email"],
.ck-field input[type="password"],
.ck-field select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.ck-field input:focus,
.ck-field select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0,124,186,0.1);
}

/* Password field with toggle */
.ck-password-field {
    position: relative;
}

.ck-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #6c757d;
    padding: 4px;
}

.ck-password-toggle:hover {
    color: #495057;
}

/* Checkbox field */
.ck-checkbox-field {
    display: flex;
    align-items: center;
}

.ck-checkbox-field label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
}

.ck-checkbox-field input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* Login actions */
.ck-login-actions {
    padding: 0 30px 20px;
}

.ck-login-btn {
    width: 100%;
    padding: 14px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.ck-login-btn:hover {
    background: #005a87;
}

.ck-login-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.ck-btn-loading {
    display: none;
}

.ck-login-btn.loading .ck-btn-text {
    display: none;
}

.ck-login-btn.loading .ck-btn-loading {
    display: inline;
}

/* Messages */
.ck-login-messages {
    padding: 0 30px;
    margin-bottom: 20px;
}

.ck-message {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 10px;
}

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

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

.ck-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Footer */
.ck-login-footer {
    padding: 20px 30px 30px;
    text-align: center;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.ck-forgot-password {
    color: #007cba;
    text-decoration: none;
    font-size: 14px;
}

.ck-forgot-password:hover {
    text-decoration: underline;
}

/* Logged in state */
.ck-logged-in-state {
    max-width: 500px;
    margin: 40px auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 30px;
}

.ck-user-info {
    display: flex;
    align-items: center;
}

.ck-user-avatar {
    margin-right: 20px;
}

.ck-user-avatar img {
    border-radius: 50%;
}

.ck-user-details h4 {
    margin: 0 0 5px 0;
    color: #495057;
    font-size: 1.3rem;
}

.ck-user-school,
.ck-user-role {
    margin: 0 0 5px 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.ck-user-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.ck-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

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

.ck-btn-account:hover {
    background: #218838;
    color: white;
}

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

.ck-btn-logout:hover {
    background: #c82333;
    color: white;
}

/* Logout link */
.ck-logout-link {
    cursor: pointer;
    color: #dc3545;
    text-decoration: none;
}

.ck-logout-link:hover {
    color: #c82333;
    text-decoration: underline;
}

/* Loading animation */
@keyframes ck-loading {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ck-loading-spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: ck-loading 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

/* Responsive */
@media (max-width: 480px) {
    .ck-login-form-container {
        margin: 20px;
        max-width: none;
    }
    
    .ck-login-header,
    .ck-login-fields,
    .ck-login-actions,
    .ck-login-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .ck-logged-in-state {
        margin: 20px;
        max-width: none;
        padding: 20px;
    }
    
    .ck-user-info {
        flex-direction: column;
        text-align: center;
    }
    
    .ck-user-avatar {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .ck-user-actions {
        flex-direction: column;
    }
}

/* School selector enhancement */
.ck-field select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

/* Focus states for accessibility */
.ck-login-btn:focus,
.ck-btn:focus,
.ck-logout-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ck-login-form-container {
        border: 2px solid #000;
    }
    
    .ck-field input,
    .ck-field select {
        border: 2px solid #000;
    }
    
    .ck-login-btn {
        border: 2px solid #000;
    }
}