/* ========================================
   AGIL PROPOSAL BUILDER - STYLES
   Sistema de Propostas Comerciais
   ======================================== */

:root {
    --primary: #0066cc;
    --accent: #ff6600;
    --background: #ffffff;
    --text: #333333;
    --dark: #1a1a1a;
    --dark-lighter: #2a2a2a;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-50);
    color: var(--text);
    line-height: 1.6;
}

/* Layout Principal */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--dark) 0%, var(--dark-lighter) 100%);
    color: white;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-logo {
    max-width: 140px;
    height: auto;
    margin-bottom: 0.5rem;
}

.sidebar-header h2 {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.logo-container {
    text-align: center;
    padding: 1rem 0 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 1.5rem;
}

.logo-container img {
    max-width: 180px;
    height: auto;
}

.app-title {
    font-size: 0.875rem;
    margin-top: 0.75rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Navegação */
.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.nav-link:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.nav-link.active {
    background: rgba(255,255,255,0.2);
    color: white;
    font-weight: 600;
}

.nav-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255,255,255,0.1);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.user-info i {
    font-size: 2rem;
    opacity: 0.9;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    display: block;
    font-size: 0.8rem;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    width: 100%;
    padding: 0.5rem;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    overflow-y: auto;
    min-height: 100vh;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--dark);
    color: white;
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    z-index: 200;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.hamburger {
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    cursor: pointer;
    padding: 0;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

.mobile-logo {
    height: 35px;
    width: auto;
}

.mobile-user {
    font-size: 1.5rem;
    cursor: pointer;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--gray-800);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid var(--primary);
}

.metric-card.success { border-color: var(--success); }
.metric-card.warning { border-color: var(--warning); }
.metric-card.info { border-color: var(--info); }

.metric-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

/* Table */
.table-container {
    overflow-x: auto;
}

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

thead {
    background: var(--gray-50);
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
}

tbody tr:hover {
    background: var(--gray-50);
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #0052a3;
}

.btn-success {
    background: var(--success);
    color: white;
}

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

.btn-info {
    background: #3b82f6;
    color: white;
}

.btn-info:hover {
    background: #2563eb;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
}

.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    justify-content: center;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.status-draft { background: var(--gray-200); color: var(--gray-700); }
.status-generated { background: #dbeafe; color: #1e40af; }
.status-sent { background: #fef3c7; color: #92400e; }
.status-viewed { background: #ddd6fe; color: #5b21b6; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-expired { background: #fecaca; color: #7f1d1d; }
.status-archived { background: #e5e7eb; color: #374151; }

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

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 0.75rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-600);
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Login Page */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-lighter) 100%);
    padding: 1rem;
}

.login-container {
    background: white;
    border-radius: 1rem;
    padding: 2.5rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2), 0 10px 10px -5px rgba(0,0,0,0.04);
}

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

.login-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 1.5rem;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 0.95rem;
    color: var(--gray-600);
    font-weight: 400;
}

.login-form {
    margin-bottom: 1.5rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.login-form label i {
    margin-right: 0.5rem;
    color: var(--primary);
}

.login-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.login-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.9rem;
    border-left: 4px solid #dc2626;
}

.login-error i {
    font-size: 1.125rem;
}

.btn-login {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
}

.btn-login:hover {
    background: #0052a3;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.btn-login:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.login-footer p {
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 3px solid var(--gray-200);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-600);
}

.empty-state i {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.hidden { display: none !important; }
.flex { display: flex; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 500px;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    z-index: 10000;
    animation: slideIn 0.3s ease-out;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.toast-message {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.5;
}

.toast-hide {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 300;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .mobile-header {
        display: flex;
    }
    
    .main-content {
        margin-left: 0;
        margin-top: 60px;
        padding: 1rem;
    }
    
    .login-container {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .login-header h1 {
        font-size: 1.5rem;
    }
    
    .login-header p {
        font-size: 0.875rem;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .toast {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
    
    .modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 1.25rem;
    }
    
    .login-logo {
        max-width: 150px;
    }
    
    .login-header h1 {
        font-size: 1.25rem;
    }
    
    .login-form input {
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .btn-login {
        padding: 0.75rem 1rem;
    }
}
