/**
 * CRM Components Styles
 * Styles for CRM system components
 * 
 * @version 1.0.0
 * @author CRM Integration System
 */

/* ===== FORMS ===== */

.crm-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.crm-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crm-form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.crm-form-group .required {
    color: #dc2626;
    font-weight: bold;
}

.crm-form-group input,
.crm-form-group select,
.crm-form-group textarea {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    background: #ffffff;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.crm-form-group input:focus,
.crm-form-group select:focus,
.crm-form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.crm-form-group input.error,
.crm-form-group select.error,
.crm-form-group textarea.error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.crm-form-group input:disabled,
.crm-form-group select:disabled,
.crm-form-group textarea:disabled {
    background: #f9fafb;
    color: #6b7280;
    cursor: not-allowed;
}

.crm-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.crm-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

.crm-form-actions .crm-btn-full {
    justify-content: center;
}

.field-error {
    font-size: 12px;
    color: #dc2626;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.field-error::before {
    content: "⚠";
    font-size: 12px;
}

/* ===== CHECKBOXES ===== */

.crm-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}

.crm-checkbox input[type="checkbox"] {
    display: none;
}

.crm-checkbox-mark {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.crm-checkbox input[type="checkbox"]:checked + .crm-checkbox-mark {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.crm-checkbox input[type="checkbox"]:checked + .crm-checkbox-mark::after {
    content: "✓";
    font-size: 12px;
    font-weight: bold;
}

.crm-checkbox:hover .crm-checkbox-mark {
    border-color: #9ca3af;
}

/* ===== SELECTS ===== */

.crm-select {
    position: relative;
}

.crm-select select {
    appearance: none;
    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 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 32px;
}

/* ===== TABS ===== */

.crm-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 20px;
}

.crm-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.crm-tab:hover {
    color: #374151;
    background: #f9fafb;
}

.crm-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: #eff6ff;
}

.crm-tab-content {
    display: none;
}

.crm-tab-content.active {
    display: block;
}

/* ===== CARDS ===== */

.crm-account-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.crm-account-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.crm-account-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.crm-account-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.crm-account-type {
    background: #dbeafe;
    color: #1e40af;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.crm-account-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.crm-account-balance,
.crm-account-equity,
.crm-account-margin,
.crm-account-free-margin {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crm-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crm-value {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

/* ===== LISTS ===== */

.crm-tickets-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.crm-ticket-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
}

.crm-ticket-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.crm-ticket-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.crm-ticket-id {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.crm-ticket-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crm-status-open {
    background: #dbeafe;
    color: #1e40af;
}

.crm-status-closed {
    background: #d1fae5;
    color: #065f46;
}

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

.crm-ticket-content h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.crm-ticket-content p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

/* ===== NOTIFICATIONS ===== */

.crm-notifications {
    position: fixed;
    z-index: 10001;
    pointer-events: none;
}

.crm-notifications-top-right {
    top: 20px;
    right: 20px;
}

.crm-notifications-top-left {
    top: 20px;
    left: 20px;
}

.crm-notifications-bottom-right {
    bottom: 20px;
    right: 20px;
}

.crm-notifications-bottom-left {
    bottom: 20px;
    left: 20px;
}

.crm-notification {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    margin-bottom: 12px;
    max-width: 400px;
    pointer-events: auto;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.crm-notification-show {
    transform: translateX(0);
    opacity: 1;
}

.crm-notification-hide {
    transform: translateX(100%);
    opacity: 0;
}

.crm-notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.crm-notification-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.crm-notification-success .crm-notification-icon {
    background: #d1fae5;
    color: #065f46;
}

.crm-notification-error .crm-notification-icon {
    background: #fee2e2;
    color: #991b1b;
}

.crm-notification-warning .crm-notification-icon {
    background: #fef3c7;
    color: #92400e;
}

.crm-notification-info .crm-notification-icon {
    background: #dbeafe;
    color: #1e40af;
}

.crm-notification-message {
    flex: 1;
    font-size: 14px;
    color: #374151;
    line-height: 1.4;
}

.crm-notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
}

.crm-notification-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ===== SECTIONS ===== */

.crm-section-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.crm-section-header h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.crm-section-header p {
    margin: 0;
    font-size: 16px;
    color: #6b7280;
    line-height: 1.5;
}

.crm-section-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ===== FUNDS ===== */

.crm-funds-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.crm-funds-tabs .crm-tab {
    flex: 1;
    text-align: center;
}

/* ===== SUPPORT ===== */

.crm-support-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.crm-support-tabs .crm-tab {
    flex: 1;
    text-align: center;
}

/* ===== SETTINGS ===== */

.crm-settings-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.crm-settings-tabs .crm-tab {
    flex: 1;
    text-align: center;
}

/* ===== WEBTRADER MENU ===== */

.crm-menu-section {
    margin: 20px 0;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.crm-menu-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.crm-menu-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.crm-menu-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.crm-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #475569;
}

.crm-menu-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.crm-menu-item i {
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crm-menu-item span {
    font-size: 14px;
    font-weight: 500;
}



/* ===== MESSAGES ===== */

.crm-message {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}

.crm-message-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.crm-message-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #86efac;
}

.crm-message-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.crm-message-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ===== LOGIN ===== */

.crm-login-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.crm-login-footer p {
    margin: 8px 0;
    font-size: 14px;
    color: #6b7280;
}

.crm-login-footer a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.crm-login-footer a:hover {
    text-decoration: underline;
}

.crm-login-info {
    margin-top: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.crm-login-info p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

/* ===== RESPONSIVENESS ===== */

@media (max-width: 768px) {
    .crm-form-actions {
        flex-direction: column;
    }
    
    .crm-account-details {
        grid-template-columns: 1fr;
    }
    
    .crm-tabs {
        flex-wrap: wrap;
    }
    
    .crm-tab {
        flex: 1;
        min-width: 120px;
    }
    
    .crm-notification {
        max-width: calc(100vw - 40px);
    }
    
    .crm-menu-items {
        gap: 6px;
    }
    
    .crm-menu-item {
        padding: 10px 12px;
    }
    
    .crm-menu-item span {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .crm-form {
        gap: 16px;
    }
    
    .crm-form-group {
        gap: 4px;
    }
    
    .crm-form-group input,
    .crm-form-group select,
    .crm-form-group textarea {
        padding: 8px 10px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .crm-account-card {
        padding: 16px;
    }
    
    .crm-account-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .crm-ticket-item {
        padding: 12px;
    }
    
    .crm-ticket-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .crm-notification {
        margin: 0 10px 12px 10px;
        max-width: none;
    }
    
    .crm-menu-item span {
        display: none;
    }
    
    .crm-menu-item {
        justify-content: center;
        padding: 12px;
    }
    
    .crm-menu-item i {
        font-size: 20px;
    }
}

/* ===== DARK THEME ===== */

@media (prefers-color-scheme: dark) {
    .crm-form-group label {
        color: #d1d5db;
    }
    
    .crm-form-group input,
    .crm-form-group select,
    .crm-form-group textarea {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .crm-form-group input:focus,
    .crm-form-group select:focus,
    .crm-form-group textarea:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }
    
    .crm-form-group input:disabled,
    .crm-form-group select:disabled,
    .crm-form-group textarea:disabled {
        background: #1f2937;
        color: #9ca3af;
    }
    
    .crm-checkbox {
        color: #d1d5db;
    }
    
    .crm-checkbox-mark {
        background: #374151;
        border-color: #4b5563;
    }
    
    .crm-checkbox input[type="checkbox"]:checked + .crm-checkbox-mark {
        background: #2563eb;
        border-color: #2563eb;
    }
    
    .crm-tab {
        color: #9ca3af;
    }
    
    .crm-tab:hover {
        color: #d1d5db;
        background: #374151;
    }
    
    .crm-tab.active {
        color: #60a5fa;
        background: #1e3a8a;
    }
    
    .crm-account-card {
        background: #1f2937;
        border-color: #374151;
    }
    
    .crm-account-header h3 {
        color: #f9fafb;
    }
    
    .crm-account-type {
        background: #1e3a8a;
        color: #93c5fd;
    }
    
    .crm-value {
        color: #f9fafb;
    }
    
    .crm-ticket-item {
        background: #1f2937;
        border-color: #374151;
    }
    
    .crm-ticket-content h4 {
        color: #f9fafb;
    }
    
    .crm-ticket-content p {
        color: #9ca3af;
    }
    
    .crm-notification {
        background: #1f2937;
        border-color: #374151;
    }
    
    .crm-notification-message {
        color: #d1d5db;
    }
    
    .crm-section-header h2 {
        color: #f9fafb;
    }
    
    .crm-section-header p {
        color: #9ca3af;
    }
    
    .crm-menu-section {
        background: #111827;
        border-color: #374151;
    }
    
    .crm-menu-header h4 {
        color: #f9fafb;
    }
    
    .crm-menu-item {
        background: #1f2937;
        border-color: #374151;
        color: #d1d5db;
    }
    
    .crm-menu-item:hover {
        background: #374151;
        border-color: #4b5563;
    }
    
    
    .crm-login-footer p {
        color: #9ca3af;
    }
    
    .crm-login-info {
        background: #111827;
        border-color: #374151;
    }
    
    .crm-login-info p {
        color: #9ca3af;
    }
}
