* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: lightgray;
    --bg-image: url('../images/background.webp');  
    --primary: #4CAF50;
    --primary-dark: #45a049;
    --surface: #ffffff;
    --radius: 10px;
    --font-sans: 'Inter', Arial, sans-serif;
}

html, body { height: 100%; }

body {
    font-family: var(--font-sans);
    background-color: var(--bg);
    background-image: var(--bg-image);
    min-height: 100vh;
    min-height: 100svh; /* bolje za mobitele */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    margin: 0;
    color: #222;
    overflow-x: hidden;
}

/* BACK BUTTON */
.back-btn {
    position: fixed; /* BITNO: izvan flowa da ne utječe na centriranje */
    top: 20px;
    left: 20px;
    padding: 12px 16px;
    background: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 50%;
    font-size: 22px;
    z-index: 9999;
}

.back-btn:hover {
    background: #5a6268;
}

form {
    background: white;
    padding: 40px 30px;
    max-width: 500px;
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 28px;
}

label {
    display: block;
    font-weight: bold;
    margin-top: 15px;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px;
    margin: 12px 0;
    border: 1px solid #d0d6db;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
    background-color: var(--surface);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 6px 18px rgba(0, 123, 255, 0.12);
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23333' d='M2 0L0 2h4L2 0zM2 5L0 3h4L2 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    padding-right: 30px;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

button {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: var(--surface);
    border: var(--primary) solid 2px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    margin-top: 15px;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    box-shadow: 0 6px 18px rgba(0,123,255,0.06);
}

button:hover, button:focus {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.reg {
    width: 100%;
    padding: 12px;
    background: white;
    color: #4CAF50;
    text-align: center;
    border: 2px #4CAF50 solid;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px;
    text-decoration: none;
    margin-top: 15px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: block;
    box-sizing: border-box;
}

.reg:hover {
    background:#45a049;
    color: white;
}

.naslov {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

/* ========== TABLE STYLES ========== */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
}

th, td {
    padding: 14px 18px;
    border-bottom: 1px solid #ccc;
    text-align: left;
    font-size: 15px;
}

th {
    background: #007bff;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: #f1f1f1;
}

/* ========== BUTTONS IN TABLE ========== */
.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    color: white;
    font-weight: bold;
    transition: all 0.3s ease;
}

.odobri {
    background: #28a745;
}

.odobri:hover {
    background: #218838;
}

.obrisi {
    background: #dc3545;
}

.obrisi:hover {
    background: #a51c2a;
}

table form {
    display: inline;
    padding: 0;
    box-shadow: none;
    margin: 0;
}

table button {
    padding: 6px 10px;
    background: #dc3545;
    border: none;
    color: white;
    margin: 0;
    width: auto;
}

table button:hover {
    background: #a51c2a;
}

/* ========== MESSAGES ========== */
.message-success {
    max-width: 500px;
    margin: 20px auto;
    padding: 15px;
    border-radius: 5px;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    text-align: center;
}

.message-error {
    max-width: 500px;
    margin: 20px auto;
    padding: 15px;
    border-radius: 5px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    text-align: center;
}

/* ========== RESPONSIVE ========== */


/* Larger screens */
@media (min-width: 769px) and (max-width: 1024px) {
    body { padding: 70px 30px; }
    form { max-width: 640px; padding: 34px 30px; }
    form h2 { font-size: 22px; }
    h1 { font-size: 26px; }
}

@media (min-width: 1025px) {
    body { padding: 90px 40px; }
    form { max-width: 720px; padding: 40px 36px; }
    form h2 { font-size: 24px; }
    h1 { font-size: 30px; }
}

@media (max-width: 768px) {
    /* OSTAVI FLEX da bi centriranje radilo */
    body {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 92px 16px 24px; /* gornji padding da back-btn ne pokrije form */
        min-height: 100svh;
        overflow-y: auto; /* ako je register visok */
    }

    .back-btn {
        top: 14px;
        left: 14px;
    }

    form {
        padding: 24px 18px;
        max-width: 520px;
    }

    form h2 { font-size: 20px; }
    h1 { font-size: 24px; }

    table { font-size: 12px; }
    th, td { padding: 10px; }
}



/* EXTRA SMALL (phones) */
@media (max-width: 480px) {
    body {
        /* Mijenjamo iz centriranog u vertikalni raspored */
        display: flex;
        flex-direction: column;
        justify-content: flex-start; 
        align-items: center;
        /* Veći gornji padding da osiguramo prostor za gumb */
        padding: 80px 15px 30px; 
    }

    .back-btn {
        /* Smanjujemo gumb da ne zauzima previše mjesta */
        top: 15px;
        left: 15px;
        padding: 10px 14px;
        font-size: 18px;
    }

    form {
        /* Forma zauzima širinu ekrana minus paddingi */
        padding: 25px 20px;
        margin-top: 0;
        border-radius: 8px;
    }

    h1, form h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    label {
        font-size: 13px;
        margin-top: 10px;
    }

    input, select, textarea {
        padding: 10px;
        font-size: 14px;
    }
}


/* Ako je ekran nizak (tipično kad tipkovnica otvori ili mali mob) */
@media (max-width: 768px) and (max-height: 640px) {
    body {
        justify-content: flex-start; /* da ne reže dno forme */
    }
    form {
        margin-top: 10px;
        margin-bottom: 24px;
    }
}