/* VetCare Plus - Common Styles */

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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --light-bg: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--light-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

/* Navbar */
.navbar {
    background: white;
    box-shadow: 0 2px 8px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.navbar-brand .brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
}

.brand-icon {
    font-size: 1.5rem;
}

/* Hamburger Menu Button */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 101;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 24px;
}

.hamburger span {
    display: block;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hamburger animation when active */
.navbar-toggle.active .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.navbar-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.navbar-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    font-size: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-link:hover {
    background-color: rgba(37, 99, 235, 0.1);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem 0;
}

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

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Alerts */
.alert {
    padding: 0.875rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

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

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

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

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.2);
}

/* Tables */
.table-container {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px var(--shadow);
    overflow-x: auto;
}

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

.medicine-table th,
.medicine-table td {
    padding: 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.medicine-table th {
    background-color: var(--light-bg);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.medicine-table td {
    font-size: 0.875rem;
}

.medicine-table tbody tr:hover {
    background-color: var(--light-bg);
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem !important;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Badges */
.quantity-badge {
    padding: 0.25rem 0.625rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

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

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-secondary {
    padding: 0.25rem 0.625rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #e2e8f0;
    color: #475569;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 1rem;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-control {
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.required {
    color: var(--danger-color);
}

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

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Search Section */
.search-section {
    margin-bottom: 1.5rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer p {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Custom Alert Modal */
.alert-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.alert-modal-content {
    background: white;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-modal-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.alert-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.alert-modal-body {
    padding: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

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

/* Confirm Modal */
.confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.confirm-modal-content {
    background: white;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease-out;
}

/* Floating Action Button (FAB) */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 999;
}

.fab:hover {
    background-color: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    min-height: 44px;
}

.filter-btn:hover {
    background-color: var(--light-bg);
    border-color: var(--primary-color);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .navbar .container {
        flex-direction: row;
        padding: 0.75rem;
    }
    
    /* Show hamburger menu on mobile */
    .navbar-toggle {
        display: block;
    }
    
    /* Hide menu by default on mobile */
    .navbar-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, box-shadow 0.3s ease;
        box-shadow: none;
        gap: 0;
    }
    
    /* Show menu when active */
    .navbar-menu.active {
        max-height: 500px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        border-top: 1px solid var(--border-color);
    }
    
    .nav-link {
        padding: 1rem 1.5rem;
        font-size: 0.875rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        width: 100%;
        border-radius: 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .medicine-table {
        min-width: 600px;
    }
    
    .medicine-table th,
    .medicine-table td {
        padding: 0.625rem 0.5rem;
        font-size: 0.8125rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-control {
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body {
        padding: 1rem;
    }
    
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
    }
    
    .btn-icon {
        font-size: 1.5rem;
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
    }
    
    .action-buttons {
        gap: 0.75rem;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions .btn {
        width: 100%;
    }
}

/* Extra small devices - Horizontal Scrolling Table */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .navbar-brand .brand-link {
        font-size: 1.125rem;
    }
    
    .brand-icon {
        font-size: 1.25rem;
    }
    
    /* Keep table layout but make it scrollable horizontally */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 0.5rem;
    }
    
    .medicine-table {
        min-width: 100%;
        font-size: 0.75rem;
    }
    
    .medicine-table th,
    .medicine-table td {
        padding: 0.5rem 0.375rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .medicine-table th {
        font-size: 0.7rem;
        position: sticky;
        top: 0;
        background-color: var(--light-bg);
        z-index: 10;
    }
    
    /* Compact action buttons */
    .action-buttons {
        gap: 0.25rem;
        flex-wrap: nowrap;
    }
    
    .btn-icon {
        font-size: 1rem;
        padding: 0.25rem;
        min-width: 32px;
        min-height: 32px;
    }
    
    /* Make badges more compact */
    .quantity-badge,
    .badge-secondary {
        padding: 0.125rem 0.375rem;
        font-size: 0.65rem;
    }
    
    .modal-content,
    .alert-modal-content,
    .confirm-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-right: 1rem;
}

.pagination-btn {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    min-height: 44px;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--light-bg);
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.page-size-selector select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    min-height: 44px;
}

@media (max-width: 768px) {
    .pagination {
        gap: 0.25rem;
    }
    
    .pagination-info {
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
        margin-right: 0;
    }
    
    .page-size-selector {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }
    
    /* FAB on mobile */
    .fab {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 56px;
        height: 56px;
    }
    
    /* Filter buttons on mobile */
    .filter-buttons {
        gap: 0.375rem;
    }
    
    .filter-btn {
        flex: 1;
        min-width: 100px;
        font-size: 0.8125rem;
        padding: 0.625rem 0.75rem;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar .container {
        flex-direction: row;
    }
    
    .navbar-menu {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.login-header {
    text-align: center;
    padding: 2rem 2rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.login-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.login-form {
    padding: 2rem;
}

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

.login-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

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

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

.login-button {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.login-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.default-credentials {
    margin: 1.5rem 2rem;
    padding: 1rem;
    background-color: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 0.5rem;
}

.default-credentials-title {
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.default-credentials-text {
    color: #78350f;
    font-size: 0.875rem;
    line-height: 1.6;
}

.login-footer {
    text-align: center;
    padding: 1.5rem;
    background-color: var(--light-bg);
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

/* Login Page Mobile Responsive */
@media (max-width: 480px) {
    .login-container {
        padding: 0.5rem;
    }
    
    .login-card {
        border-radius: 0.75rem;
    }
    
    .login-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .login-icon {
        font-size: 2.5rem;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
    
    .login-subtitle {
        font-size: 0.875rem;
    }
    
    .login-form {
        padding: 1.5rem;
    }
    
    .default-credentials {
        margin: 1rem 1.5rem;
    }
}